An electromagnet uses electricity to create the magnetic field.Moving charges create magnetic fields. Knowing that, if we have alot of copper wire (with a suitable insulator) wrapped around aniron core, we can send direct current through that wire, and itwill create a magnetic field. The magnetic field will magnetize theiron core, and the core becomes a magnet. Wrapping wire around anail and connecting a battery to the ends of the wire will make asimple electromagnet.