HomeArticlesElectromagnetism

Magnetism Explained: From Spinning Electrons to Field Lines

Magnetism has no classical origin at all — it comes from the quantum spin and orbital motion of electrons. Here's how that quantum foundation builds up to the field lines you can drag a compass through.

mysimulator teamUpdated July 2026≈ 8 min read▶ Open the simulation

Atomic origins: spin and orbital moment

Every electron carries two sources of magnetic moment. Its orbital motion around the nucleus behaves like a tiny current loop, giving μ_L = -e/(2m_e)·L. Its intrinsic spin — with no classical analogue at all — contributes μ_S = -g_S·e/(2m_e)·S, where the Landé g-factor g_S ≈ 2.002. Hund's rules determine how electrons fill an atom's shells to maximise total spin first, then orbital momentum. Iron ([Ar] 3d⁶4s²) ends up with four unpaired spins and a moment of 4 Bohr magnetons per atom — cobalt has 3, nickel 0.6, and gadolinium the highest of any element at 7.

Dia-, para- and ferromagnetism

Every material is weakly diamagnetic — an applied field induces orbital currents that oppose it (Lenz's law), giving a tiny negative susceptibility. Materials with unpaired electrons but no cooperative ordering are paramagnetic: moments align partially with the field, and susceptibility falls with temperature as Curie's law χ = C/T. In ferromagnets — iron, cobalt, nickel — a strong exchange interaction between neighbouring spins causes spontaneous parallel alignment even with no applied field, below a critical Curie temperature (1044 K for iron).

live demo · field lines between two poles● LIVE

Exchange interaction: why spins line up

The Heisenberg exchange Hamiltonian, H = −2J·Σ S_i·S_j, sets the sign of J from the interplay of the Pauli exclusion principle and Coulomb repulsion: electrons with parallel spins must occupy different spatial orbitals, keeping them farther apart and lowering their Coulomb energy. When that effect wins, J > 0 and parallel alignment is favoured — ferromagnetism. Iron, cobalt and nickel all satisfy the Stoner criterion for band ferromagnetism, I(E_F)·D(E_F) > 1, thanks to a high density of states at the Fermi level in the 3d transition metals.

Domains, hysteresis and hard versus soft magnets

A ferromagnet below its Curie temperature still splits into magnetic domains — regions of uniform magnetisation pointing different directions — because this closes flux internally and lowers total magnetostatic energy. Domains are separated by Bloch walls where magnetisation rotates 180° over roughly 10-100 nm. Under an applied field, favourably oriented domains grow while walls pin at grain boundaries and defects, producing irreversible hysteresis. Soft magnets (electrical steel, permalloy) have low coercivity and a small hysteresis loop, ideal for transformer cores that must switch cheaply. Hard magnets (AlNiCo, SmCo₅, and especially Nd₂Fe₁₄B with an energy product up to 520 kJ/m³) resist demagnetisation and hold their field permanently — the basis of EV motors, headphones and hard-disk read heads.

Frequently asked questions

Why does iron stick to a magnet but copper doesn't?

Iron atoms have four unpaired electron spins in a partially filled 3d shell, giving each atom a large magnetic moment, and the exchange interaction locks neighbouring atoms' spins parallel below iron's Curie temperature of 1044 K. Copper's electron shells are filled, leaving no large uncompensated moment for exchange coupling to align.

What is the difference between hard and soft magnetic materials?

Soft magnets, such as electrical steel and ferrites, have low coercivity: easy to magnetise and demagnetise, with a small hysteresis loop and low energy loss, ideal for transformer cores. Hard magnets, such as neodymium or SmCo, have high coercivity and resist demagnetisation, making them permanent magnets for motors and speakers.

Why do magnetic domains form inside a magnet?

A single uniformly magnetised block would create a large demagnetising field outside itself, which costs magnetostatic energy. Splitting into domains pointing different directions closes the magnetic flux internally and lowers the total energy, at the cost of narrow domain walls where spins rotate between orientations.

Try it live

Everything above runs in your browser — open Magnetic Field Lines, place north and south poles on the canvas, and watch field lines, particle streams and heat maps form in real time.

▶ Open Magnetic Field Lines simulation

What did you find?

Add reproduction steps (optional)