The energy stored in a magnetic field is

with magnetic energy density

Like Electrostatic energy, this energy isn’t localized on currents or magnets. It’s stored in the field that fills space.

Derivation via inductor

Build up the current through an inductor of inductance from to in time . The voltage required is , instantaneous power . Total energy:

The factor catches everyone. Same origin as in : the field builds gradually, so the average during charging is .

Generalization

Specialize to a solenoid of length , turns, cross-section , current . Field inside: , so . Inductance . Stored energy:

Rewrite using and volume :

So inside the solenoid, the energy density is , uniform across the interior.

This expression turns out to be valid in general, not just for solenoids: at every point in space with a magnetic field, the local energy density is . Integrating over all space recovers the total.

Worked example: coaxial cable

Inner radius , outer , length , current , permeability between conductors. The field is for , zero elsewhere (approximately).

Cross-check with and : yes, . Match.

Duality with electric

Electrostatic and magnetic energy densities are dual:

ElectricMagnetic
Density
Circuit form
Material constant

In an electromagnetic wave both densities coexist, with average values equal: half the wave’s energy is “electric,” half is “magnetic.” The propagating energy flux is the Poynting vector .

Why factor 1/2

Same explanation as for electrostatic energy: bring up the current (or charge) gradually. Early bits of current don’t see the full final field — they see whatever field has been built so far, which is proportional to the current. So work done on each is , integrated to . The half is built into the integral, not added by hand.