The formula for the energy stored in a magnetic field is E = 1/2 LI2. The energy stored in a magnetic field is equal to the work needed to produce a current through the inductor. Energy is stored in a magnetic field. Energy density can be written as uB=B22\u03bc u B = B 2 2 \u03bc .