Magnetic Field Calculator

Calculate magnetic field from a wire B = μ₀I/(2πr) or solenoid B = μ₀nI.

🧲 Magnetism📐 B = μ₀I/(2πr)⚡ Magnetic Field
Current (I) Amperes
Distance from wire (r) m
⚠️ Enter valid positive numbers.

What Is Magnetic Field?

The magnetic field B (measured in Tesla, T) is created by electric currents. For an infinitely long straight wire carrying current I, the field at perpendicular distance r is: B = μ₀I/(2πr), where μ₀ = 4π×10⁻⁷ T·m/A is the permeability of free space. The field circles the wire (right-hand rule: thumb along current, fingers curl in B direction).

For a solenoid (tightly wound coil of N turns over length L, with n = N/L turns per meter): B = μ₀nI inside (uniform and parallel to axis), and B ≈ 0 outside. Solenoids create strong uniform magnetic fields — used in MRI machines (superconducting solenoids at ≈7 T), particle accelerators, and electromagnetic brakes.

Magnetic field strength: Earth's field ≈ 5×10⁻⁵ T (50 μT). A common refrigerator magnet: 5×10⁻³ T. Clinical MRI: 1.5–7 T. Research magnets: 20–45 T (resistive) or up to 100 T in pulsed fields. Magnetic resonance requires strong uniform fields — hence solenoids.

The Biot-Savart Law gives the fundamental magnetic field from a current element: dB = μ₀I(dL×r̂)/(4πr²). For complex geometries, this integral is evaluated numerically. Ampere's Law ∮B·dL = μ₀I_enclosed is used analytically for symmetric configurations (wires, solenoids, toroids).

Formula Reference Table

Solve ForFormulaNotes
Long straight wireB = μ₀I/(2πr)μ₀ = 4π×10⁻⁷ T·m/A
Solenoid (inside)B = μ₀nIn = turns/meter
ToroidB = μ₀NI/(2πr)N = total turns, r = mean radius
Force on parallel wiresF/L = μ₀I₁I₂/(2πd)Attractive if currents parallel
Current in wire from BI = B·2πr/μ₀Inverse of wire formula
Definition of 1 AmpereF/L = 2×10⁻⁷ N/mFor wires 1 m apart with 1 A each

3 Worked Examples

Example 1
Wire B-Field

10 A wire. Find B at r = 5 cm.

  • B = μ₀I/(2πr) = (4π×10⁻⁷ × 10)/(2π × 0.05)
  • B = 4π×10⁻⁶ / (0.1π) = 4×10⁻⁵ T = 40 μT
  • Similar to Earth's magnetic field strength
✓ B = 40 μT at 5 cm from 10 A wire
Example 2
MRI Solenoid

MRI solenoid: n = 1,000 turns/m, I = 500 A (superconducting).

  • B = μ₀nI = 4π×10⁻⁷ × 1000 × 500 = 0.628 T
  • At n = 11,000 turns/m, I = 1,000 A: B = 13.8 T
  • Superconducting coils carry kA currents with zero resistance
✓ B = 0.628 T at 1000 t/m, 500 A
Example 3
Parallel Wire Force

Two parallel wires 10 cm apart, each carrying 100 A. Force per meter?

  • F/L = μ₀I₁I₂/(2πd) = 4π×10⁻⁷ × 100 × 100/(2π × 0.1)
  • F/L = 4π×10⁻⁷ × 10,000 / (0.2π) = 0.02 N/m
  • Attractive (currents in same direction) — 20 mN per meter of wire
✓ F/L = 20 mN/m (attractive; parallel currents)

Real-World Applications

🏥
MRI Machines
Clinical MRI uses 1.5–3 T superconducting solenoids cooled to 4 K. Stronger fields (7 T research MRI) give better signal-to-noise. The B = μ₀nI formula guides coil design.
🔍
Particle Accelerators
LHC dipole magnets: 8.33 T bending field from superconducting coils carrying 11,700 A. The field curves 7 TeV protons in a 27 km ring.
🔋
Electric Motors
Motor magnetic fields are generated by current-carrying coils. B = μ₀nI determines the flux density; force on armature conductors = BIL (Lorentz force).
🚂
Maglev Trains
Superconducting magnets on Japanese maglev trains produce ~5 T fields that levitate and guide the train. JR Central L0 series reached 603 km/h in 2015.
🔬
Helmholtz Coils
Two circular coils separated by their radius create a highly uniform magnetic field at the center — used in physics labs to cancel Earth's field or create calibrated test fields.

Common Mistakes to Avoid

⚠️
Forgetting μ₀ = 4π×10⁻⁷

μ₀ must be in SI units: 4π×10⁻⁷ T·m/A = 1.257×10⁻⁶ T·m/A. Using 4π (without the 10⁻⁷) gives B 10⁷× too large.

⚠️
Using diameter instead of distance r

B = μ₀I/(2πr): r is the perpendicular distance from the wire to the field point, not the wire's diameter.

⚠️
Applying wire formula to solenoid and vice versa

Solenoid: B = μ₀nI (inside, uniform). Wire: B = μ₀I/(2πr) (outside, varies with distance). They are different geometries.

⚠️
Wrong direction from right-hand rule

Curl right-hand fingers around wire with thumb pointing in current direction — fingers show B field curl direction. For force on a wire: F = IL×B (cross product).

⚠️
Ignoring iron core amplification

Iron-core electromagnets: B = μ₀μᵣnI. Iron has μᵣ ≈ 1,000–100,000, dramatically amplifying B. For air-core, μᵣ = 1.

Frequently Asked Questions

What is the right-hand rule for magnetic fields?
Wrap your right hand around a straight wire with your thumb pointing in the direction of conventional current. Your curled fingers show the direction of the magnetic field circles around the wire. For a solenoid, curl fingers in the direction of current flow through the coils; the thumb points in the direction of the magnetic field inside (North pole direction).
What is Ampere's Law?
∮B·dL = μ₀I_enclosed: the line integral of B around a closed path equals μ₀ times the current enclosed. For a long wire: ∮B·dL = B(2πr) = μ₀I → B = μ₀I/(2πr). For a solenoid: choosing a rectangular loop — B×L(inside) + 0 = μ₀nLI → B = μ₀nI.
What is a superconducting magnet?
Below a critical temperature (Tc), superconductors have zero electrical resistance. Current flows indefinitely without power loss. MRI and accelerator magnets use NbTi (Tc = 9.2 K) or Nb₃Sn (Tc = 18.3 K) cooled by liquid helium. Once charged (weeks-long process), they maintain field with no power input.
Why is the Earth's magnetic field important?
The magnetosphere (B ≈ 30,000–60,000 nT at surface) deflects solar wind particles, protecting the atmosphere from erosion. Without it, Earth would lose water to space (as Mars did). Compass navigation uses the horizontal component ≈ 20,000 nT.
How is magnetic field measured?
Hall effect sensors: voltage proportional to B (compact, 0–10 T range). Fluxgate magnetometers: for weak fields (< 1 mT). SQUID (Superconducting Quantum Interference Device): measures fields as small as 10⁻¹⁵ T (femtotesla) — used for brain imaging (MEG) and geological surveys.
What is magnetic flux and Faraday's Law?
Magnetic flux Φ = B·A·cos(θ) (Webers). Faraday's Law: EMF = −dΦ/dt — a changing magnetic flux induces a voltage. This is the principle behind generators, transformers, induction motors, wireless charging, and induction cooking.
What is the difference between B and H?
B is magnetic flux density (Tesla) — the actual field in the material. H is magnetic field intensity (A/m) — related to the free currents. B = μ₀(H + M) = μ₀μᵣH, where M is magnetization and μᵣ is relative permeability. In free space: B = μ₀H. In iron (μᵣ = 1,000): B = 1,000 μ₀H.
What is magnetic shielding?
High-μᵣ materials (mu-metal: μᵣ ≈ 50,000–100,000) redirect magnetic flux through themselves, bypassing the shielded region. Used in CRT monitors, sensitive instruments, and MRI rooms to exclude Earth's field and interference. Superconductors expel magnetic fields entirely (Meissner effect) — perfect diamagnets (μᵣ = 0).

Related Physics Calculators

Formula Explorer connections

Interpretation: This relationship connects magnetic fields, moving charge, flux, induction or electromagnetic material response. Assumption: Specify field direction and sign convention. Uniform fields, linear materials, negligible edge effects or sinusoidal steady state may be assumed.

Solenoid & Toroid Magnetic Field Calculator →Magnetic Flux Calculator →Mutual Inductance Calculator →Physics Formula Explorer →