The spinning of the electrons around the nucleus of an atom creates a tiny magnetic field. The electrons in most objects spin in random directions, and their magnetic forces cancel each other out.
Magnets are different because the molecules in magnets are arranged so that their electrons spin in the same direction. This arrangement and movement creates a magnetic force that flows out from a north-seeking pole and from a south-seeking pole. This magnetic force creates a magnetic field around a magnet.
Have you ever held two magnets close to each other? They don't act like most objects. If you try to push the two north poles or two south poles together, they repel each other. But if you put a north pole and a south pole together, the magnets will stick together because the north and south poles attract each other. Just like protons and electrons—opposites attract in magnets.
Magnetic fields can be used to make electricity
The properties of magnets can be used to make electricity. Moving magnetic fields pull and push electrons. Metals such as copper have electrons that are loosely held, so moving magnets can easily push the electrons in copper wires.
By using moving magnets and copper wire together, electric generators create electricity. Electric generators essentially convert kinetic energy (the energy of motion) into electrical energy.