An electromagnet can be constructed by wrapping an iron or steel bar with a current-carrying wire. When used as the core of an electromagnet, the ferromagnetic properties of iron or steel allow the magnetic domains to align. Wrapping a nail or other steel item with insulated wire, which is then hooked up to an electrical current, will magnetize the core. When powered, electromagnets function just like permanent magnets.
The first electromagnet was invented in 1820. The simple physics governing electromagnetism allows anyone to construct such a magnet using common everyday items. A large iron or steel nail, at least 3 inches or longer, makes a suitable core for a simple electromagnet. Household D-size batteries produce an electrical current that is strong enough to create an operational magnet. Tightly wrapping the nail or other object with coated or insulated copper wire and ensuring the ends are exposed and able to be connected to the battery is all that is required.
Once the wire is attached to a power source and current is passed through it, the core becomes magnetized and will possess enough force to attract certain types of metals. Once disconnected from its power source, an electromagnet will no longer function.