Magnetic fields are created either by the motion of electrical
charges, or by the alignment of the spins of charged particles, like
Each electron acts like a little bar magnet, but in most
materials, all the electrons are arranged so that their magnetic fields
point in opposite directions and cancel out. Some materials, like iron,
have electrons whose spins do not cancel out with their neighbors, and
even like to spin in the same direction as their neighbors. Many bar
and horseshoe magnets are made out of iron. Some other materials and
mixtures of materials can make even stronger magnets than is possible
with just iron.
To make a stronger magnet still, you can wind a wire in a coil and
pass current through it. The moving electrons in the wire will set up a
magnetic field whose strength is directly proportional to how much
current is going through the wire.
The earth has a magnetic field around it, which is made from
flowing currents in the earth's core (there may even be some magnetized
material too, where the spins are aligned).
You might want to search this site for many more answers about magnets.
(published on 10/22/2007)