Magnetic Field Calculator

Current Doesn't Just Flow — It Radiates

Any current-carrying conductor generates a magnetic field around it, a fact Hans Christian Ørsted discovered by accident in 1820 when a compass needle near his circuit refused to sit still. The field's shape and strength depend entirely on the conductor's geometry — a straight wire, a loop, and a coiled solenoid each produce a different pattern from the same current. This calculator handles all three.

The Formulas

Long straight wire: B = (μ0 × I) / (2 × π × r)
Center of a circular loop: B = (μ0 × I) / (2 × R)
Inside a solenoid: B = μ0 × n × I, where n = N / L

B is magnetic flux density in tesla, I is current in amps, r or R is distance/radius in meters, N is number of turns, L is coil length in meters, and μ0 is the permeability of free space, 4π × 10-7 T·m/A.

Worked Examples

Magnetic flux density for each configuration
ConfigurationInputsResult
Straight wireI = 10 A, r = 0.05 m4.0 × 10-5 T
Circular loop centerI = 5 A, R = 0.1 m3.14 × 10-5 T
SolenoidI = 2 A, N = 500 turns, L = 0.2 m6.28 × 10-3 T

Concentrating the same general current into a tightly wound solenoid produces a field roughly two orders of magnitude stronger than a single straight wire at a comparable distance.

Reference Field Strengths

Approximate magnetic flux densities for comparison
SourceTypical Flux Density
Earth's surface magnetic field25–65 µT
Small refrigerator magnet~5 mT
Clinical MRI scanner1.5–3 T

1 tesla (T) = 1,000 millitesla (mT) = 1,000,000 microtesla (µT).

Where This Calculation Matters

  • Electromagnet and solenoid design — predicting the field a coil will generate before winding it, based on turns, length, and drive current.
  • EMI/EMC assessment — estimating stray magnetic fields near high-current conductors, relevant for sensitive nearby electronics.
  • Physics and engineering coursework — checking the three classic Ampère's-law geometries against textbook problems.
  • Sensor and relay design — many reed switches and Hall-effect sensors are specified against a known trigger flux density.

How to Use This Calculator

  1. Choose the configuration: Long Straight Wire, Center of Circular Loop, or Inside a Solenoid.
  2. For a straight wire, enter Current and Distance from Wire.
  3. For a loop, enter Current and Loop Radius.
  4. For a solenoid, enter Current, Number of Turns, and Solenoid Length.
  5. Select Calculate to see the resulting magnetic flux density.

Related Calculations

See the companion field generated by static charge with the Electric Field Calculator, or work backward from field to current with the Ohm's Law Calculator.