Skip to content
Engineering Interactive Lab

Magnetic Field of Currents

Drag current-carrying wires and see the magnetic field, field lines, and field strength around wires and coils.
AvailableIntermediate

Loading simulation…

This is taking longer than expected. Reload the page. If it keeps happening, press F12 and look for errors in the Console tab.

The physics

An electric current creates a magnetic field that circles around it. For a long straight wire, the Biot–Savart law (or Ampère's law) gives a field whose strength falls off as 1/r:

B = μ0I / (2πr)
(1)

Its direction follows the right-hand rule. Point your thumb along the current and your fingers curl the way the field circulates. In the simulation, the wires run perpendicular to the screen: ⊙ is current coming out towards you (counter-clockwise field), and ⊗ is current going in (clockwise). Fields of several wires add as vectors.

SymbolMeaningSI unit
ICurrentA
rDistance from the wirem
BMagnetic flux densityT (shown in μT)
μ₀Vacuum permeability, 1.2566 × 10⁻⁶N/A²
A_zMagnetic vector potentialT·m

Field lines and coils

Magnetic field lines never start or end: they form closed loops. For currents perpendicular to the plane, the field can be written as B = ∇ × (Az ẑ), with

Az = −(μ0/2π) Σ Ii ln ri
(2)

Field lines are the contours of Az, so they are drawn exactly that way, at equal steps of Az. The spacing between lines is then inversely proportional to the field strength. A coil seen edge-on looks like a pair of opposite currents. The field is strong and nearly uniform between them, which is the principle behind electromagnets and solenoids.

Method and validation

The field is computed exactly by superposition of equation (1). Automated tests check the single-wire formula and the right-hand rule, and check that B = ∇ × (Az ẑ). They also verify Ampère's law: the circulation of B around a closed loop equals μ0 times the enclosed current, to better than one part in a billion, even with a strong wire outside the loop.

Assumptions and limitations

  • Infinitely long, thin, straight wires perpendicular to the plane, in vacuum.
  • Steady (DC) currents. Induction and electromagnetic waves are not modelled.
  • Real coils are three-dimensional, so this cross-section is a 2D approximation.

More in Electric & Magnetic Fields