How Do Magnets Work? The Invisible Force That Shapes Our World
Magnets seem like magic, but they arise from one of the four fundamental forces of nature. Learn how electron spin creates magnetism, why some metals are magnetic, and how magnets power everything from MRI machines to electric motors.
Explain It Simply Editorial Team
Published May 21, 2026
The Atomic Origin: Electron Spin and Orbital Motion
Magnetism originates at the atomic level, from the motion of electrons. Every electron generates a magnetic field in two ways: its orbital motion around the nucleus and its intrinsic quantum property called spin.
Electron spin is one of the most counterintuitive concepts in physics. Despite the name, an electron doesn't literally spin like a top — it is a point particle with no physical surface to rotate. Spin is an intrinsic quantum mechanical property, as fundamental to the electron as its mass or charge. Each electron behaves as though it is a tiny bar magnet, with a north and south pole determined by its spin direction: 'spin up' or 'spin down.'
In most atoms, electrons are arranged in pairs with opposite spins, and their magnetic fields cancel out perfectly. This is why most materials — copper, aluminum, wood, plastic — are not magnetic. The net magnetic contribution from their electron pairs is zero.
However, in atoms of iron, cobalt, and nickel, the electron configuration leaves several electrons unpaired in the 3d orbital shell. Iron has four unpaired 3d electrons, each contributing its magnetic moment in the same direction. This gives iron atoms a strong net magnetic field. But having magnetic atoms alone isn't sufficient to create a magnet — the atoms must also cooperate with each other.
This cooperation is where quantum mechanics plays its most crucial role. In ferromagnetic materials, a quantum effect called the exchange interaction causes the unpaired electron spins on neighboring atoms to align parallel to each other. This alignment is energetically favorable — the system has lower total energy when spins are parallel — so the alignment happens spontaneously below a critical temperature called the Curie temperature (770°C for iron, 1,115°C for cobalt, 358°C for nickel).
Above the Curie temperature, thermal energy overwhelms the exchange interaction, the spins randomize, and the material loses its magnetism. This is why heating a magnet with a torch will permanently demagnetize it.
Sources: Griffiths, D. 'Introduction to Electrodynamics' (Cambridge University Press). Kittel, C. 'Introduction to Solid State Physics' (Wiley).
Iron has four unpaired electron spins that all point in the same direction, creating a strong magnetic moment. Copper's electrons are all paired, so their magnetic fields cancel out completely.
Magnetic Domains: The Micro-Architecture of Magnets
Even in a ferromagnetic material like iron, the atoms don't all point in the same direction throughout the entire piece. Instead, the material is divided into microscopic regions called magnetic domains, each typically 1-100 micrometers across — large enough to contain millions of atoms.
Within each domain, all the atomic magnets are aligned in the same direction, creating a strong local magnetic field. However, different domains point in different directions. In an unmagnetized piece of iron, the domains are oriented randomly, and their fields cancel out — the iron shows no net magnetism.
When you bring an external magnetic field near the iron (for example, by stroking it with a permanent magnet), two things happen. First, domains that are already aligned with the external field grow larger at the expense of misaligned domains — the domain walls literally move through the material. Second, if the field is strong enough, entire domains rotate to align with it. When enough domains align, the iron becomes magnetized.
In a permanent magnet, the domains have been locked into alignment by the material's crystal structure. Hard magnetic materials like neodymium-iron-boron (NdFeB) or samarium-cobalt (SmCo) have crystal structures that strongly resist domain wall motion, making them extremely difficult to demagnetize once magnetized. This is why rare-earth permanent magnets are so powerful — they can produce magnetic fields exceeding 1.4 tesla, strong enough to erase credit cards, damage electronics, and cause serious physical injuries if body parts are caught between two large magnets.
Soft magnetic materials like pure iron or silicon steel are easily magnetized and demagnetized. Their domains move freely, making them ideal for applications where the magnetic field must change rapidly — such as transformer cores and electric motor stators.
The domain structure of a magnet can be directly observed using a technique called Bitter imaging, where a liquid containing tiny iron particles is applied to the surface. The particles accumulate at domain boundaries, revealing the intricate pattern of domains under a microscope.
Sources: Cullity, B. & Graham, C. 'Introduction to Magnetic Materials' (Wiley). Coey, J. 'Magnetism and Magnetic Materials' (Cambridge University Press).
Types of Magnetism: From Diamagnetic to Ferromagnetic
Not all materials respond to magnetic fields in the same way. Physicists classify magnetic behavior into several categories based on how a material's electrons interact with external fields.
Diamagnetism is the weakest form of magnetism and is present in all materials. When an external magnetic field is applied, it slightly alters the orbital motion of electrons, inducing a tiny magnetic field that opposes the applied field. Diamagnetic materials are very weakly repelled by magnets. Water, copper, gold, bismuth, and most organic materials are diamagnetic. The effect is usually so weak it's undetectable without sensitive instruments, but with extremely powerful magnets, even water can be levitated — a phenomenon dramatically demonstrated by levitating live frogs in the laboratory of Andre Geim (who later won the Nobel Prize for graphene).
Paramagnetism occurs in materials with unpaired electrons that don't exhibit the cooperative alignment of ferromagnetism. In a paramagnetic material like aluminum, oxygen, or platinum, the individual atomic magnets align weakly with an applied field, creating a slight attraction. But the alignment is feeble and disappears completely when the external field is removed — there is no permanent magnetism. Liquid oxygen is paramagnetic and can be visibly attracted by a strong magnet, a popular physics demonstration.
Ferromagnetism is the strong, cooperative alignment that produces permanent magnets. Only iron, cobalt, nickel, and certain rare-earth elements (gadolinium, dysprosium) are ferromagnetic at room temperature. Ferromagnetic materials can be thousands to millions of times more strongly magnetic than paramagnetic ones.
Antiferromagnetism occurs when neighboring atomic spins align in alternating opposite directions, canceling each other out and producing no net magnetic field. Chromium and manganese oxide are antiferromagnetic. This seems like a useless property, but antiferromagnetic materials are increasingly important in advanced spintronic devices and next-generation computer memory.
Ferrimagnetism is similar to antiferromagnetism — neighboring spins oppose each other — but the opposing spins are unequal in magnitude, producing a net magnetic field. Magnetite (Fe₃O₄), the first magnetic material known to humans (lodestone), is ferrimagnetic. Ferrites are widely used in electronic components, magnetic recording media, and microwave devices.
Sources: Blundell, S. 'Magnetism in Condensed Matter' (Oxford University Press). Geim, A. 'Everyone's Magnetism' (Physics Today, 1998).
Electromagnets: Magnetism on Demand
In 1820, Danish physicist Hans Christian Ørsted accidentally discovered that an electric current flowing through a wire deflected a nearby compass needle. This was the first evidence that electricity and magnetism were connected — a discovery that would transform civilization.
An electromagnet is created by coiling a wire into a solenoid (helical coil) and passing electric current through it. The circular magnetic fields of each loop of wire reinforce each other, creating a strong, uniform field through the center of the coil. Wrapping the coil around a ferromagnetic core (like an iron rod) amplifies the field enormously, because the core's magnetic domains align with the coil's field.
The great advantage of electromagnets over permanent magnets is control. You can turn them on and off, adjust their strength by varying the current, and reverse their polarity by reversing the current direction. This controllability makes them indispensable in modern technology.
Electric motors use electromagnets to convert electrical energy into mechanical motion. A typical motor contains a rotating coil (rotor) inside a fixed magnetic field (stator). By rapidly switching the current direction in the coil, the motor creates a rotating magnetic field that continuously pushes the rotor around. Electric vehicles, household appliances, industrial robots, and hard disk drives all depend on electromagnetic motors.
MRI (Magnetic Resonance Imaging) machines use superconducting electromagnets cooled with liquid helium to generate magnetic fields of 1.5 to 7 tesla — roughly 30,000 to 140,000 times stronger than Earth's magnetic field. These fields align the hydrogen nuclei in your body, and radiofrequency pulses cause them to emit signals that are reconstructed into detailed three-dimensional images of soft tissue — all without radiation.
Particle accelerators like CERN's Large Hadron Collider use thousands of superconducting electromagnets to bend and focus beams of protons traveling at 99.9999991% the speed of light. The LHC's 1,232 dipole magnets each produce fields of 8.3 tesla and must be cooled to 1.9 kelvin (−271.3°C) — colder than outer space.
Sources: Ørsted, H.C. (1820). Annals of Philosophy. CERN LHC Machine Documentation.
Earth's Magnetic Field: Our Invisible Shield
The Earth itself is a giant magnet, generating a magnetic field that extends thousands of kilometers into space. This field, called the magnetosphere, shields the planet from the solar wind — a constant stream of charged particles blasting outward from the Sun at speeds of 400-800 km/s.
Earth's magnetic field is generated by the geodynamo — enormous convection currents of liquid iron and nickel in the planet's outer core, approximately 2,900 to 5,100 kilometers below the surface. These electrically conducting fluids flow in complex patterns driven by heat from the inner core and the planet's rotation (the Coriolis effect). The flowing currents generate electric currents, which in turn generate the magnetic field — a self-sustaining electromagnetic feedback loop.
The magnetic field is not static. The magnetic poles wander over time — the north magnetic pole has been drifting from Canada toward Siberia at an accelerating rate of about 55 km per year as of 2025. More dramatically, the field periodically reverses completely — north becomes south and vice versa. These geomagnetic reversals occur irregularly, roughly every 200,000 to 300,000 years on average. The last full reversal was about 780,000 years ago, meaning we are statistically overdue for the next one.
During a reversal, the field weakens significantly (but does not disappear entirely), potentially exposing the surface to increased solar and cosmic radiation. However, geological evidence shows that life survived hundreds of reversals without mass extinctions, suggesting the remaining field and the atmosphere provide adequate protection.
Without the magnetosphere, Earth would likely suffer the same fate as Mars. Mars lost its global magnetic field approximately 4 billion years ago, and the solar wind has been steadily stripping away its atmosphere ever since. Today, Mars's atmospheric pressure is less than 1% of Earth's — too thin to support liquid water on the surface. Earth's magnetic field is, in a very real sense, one of the essential conditions for life on our planet.
Sources: Glatzmaier, G. & Roberts, P. (1995). Nature (Geodynamo Simulation). European Space Agency, Swarm Mission.
The Future of Magnets: From Quantum Computing to Maglev Trains
Magnetic technology continues to advance rapidly, with applications that would have seemed like science fiction just decades ago.
Maglev (magnetic levitation) trains use powerful electromagnets to lift the entire train off the track and propel it forward without any physical contact. With no friction from wheels or rails, maglev trains can achieve extraordinary speeds. Japan's SCMaglev (superconducting maglev) holds the world speed record for rail vehicles at 603 km/h (375 mph), achieved in 2015. China's high-temperature superconducting maglev prototype has demonstrated speeds exceeding 620 km/h. Shanghai's commercial Transrapid maglev operates at 431 km/h, making the 30-km airport run in just 7 minutes.
Magnetic confinement fusion, as discussed in tokamak and stellarator reactors, uses superconducting magnets to contain plasma at 150 million degrees Celsius — potentially providing unlimited clean energy. The ITER project's magnets will produce fields strong enough to confine a plasma carrying 15 million amperes of current.
Spintronics — electronics based on electron spin rather than charge — promises faster, more energy-efficient computing. Magnetoresistive Random Access Memory (MRAM) stores data using magnetic states rather than electric charge, offering the speed of SRAM, the density of DRAM, and the non-volatility of flash memory — a potential universal memory technology.
Quantum computing relies on superconducting circuits that exploit quantum magnetic properties. The qubits in IBM and Google quantum processors are essentially tiny superconducting electromagnets whose magnetic states exist in quantum superposition — representing both 0 and 1 simultaneously.
Medical applications continue to expand. Magnetic nanoparticles are being developed for targeted drug delivery — guiding cancer-killing drugs directly to tumors using external magnetic fields. Transcranial magnetic stimulation (TMS) uses pulsed magnetic fields to non-invasively stimulate specific brain regions, treating depression, migraines, and neurological disorders.
From the lodestone compass that guided ancient sailors to the superconducting magnets probing the fundamental structure of matter, magnetism remains one of humanity's most powerful and versatile tools.
Sources: Central Japan Railway Company (SCMaglev). IBM Quantum Computing Division. National Institutes of Health (NIH) on TMS.
💡 AHA Moment
Here is the surprising truth about magnets: magnetism is not a separate, mysterious force. It is a relativistic side effect of electricity.
Every moving electric charge creates a magnetic field. The electrons inside every atom are both orbiting the nucleus and spinning on their own axes — and each of these motions generates a tiny magnetic field. In most materials, these tiny fields point in random directions and cancel out, producing no net magnetism. But in certain special materials — iron, cobalt, nickel, and their alloys — quantum mechanics causes neighboring electron spins to spontaneously align in the same direction, creating regions called magnetic domains.
When enough domains align, the material becomes a permanent magnet. The force you feel when two magnets snap together is the electromagnetic force — the same fundamental force that holds atoms together, makes lightning, and carries light across the universe. It is roughly 10³⁶ times stronger than gravity. The reason a tiny refrigerator magnet can hold a piece of paper against the gravitational pull of the entire Earth is because electromagnetism is incomprehensibly more powerful than gravity at short distances.
Want a deeper explanation?
Use our AI tool to get personalized, interactive explanations on any topic.
auto_awesomeTry It Free