🔬
🔬 Science & engineering

Solenoid & Wire Magnetic Field Calculator

Results update as you type.

Your numbers

Understanding the solenoid and wire magnetic field calculator — concept and principle

This calculator estimates the magnetic flux density inside a long solenoid and around a long straight wire, and gives the inductance of the solenoid for a 1 cm² cross-section. It helps with coil design, physics problems and checking whether a cable could disturb a compass.

Magnetic field inside a solenoid and around a straight wire2 A through 500 turns over 0.2 m gives 6.28 mT inside the coil; the same 2 A in a straight wire gives only 40 µT at 1 cm, about Earth’s field.Coiling the wire concentrates the fieldSolenoid500 turns ÷ 0.2 m= 2,500 per m, 2 AB = µ₀ × 2,500 × 26.28 mTStraight wire1 cm2 A, 1 cm awayB = µ₀I ÷ (2πr)40 µTSame 2 A: coil 157× stronger40 µT is about Earth’s field (25–65 µT)
Winding the wire stacks the field of every turn: 6.28 mT in the coil versus 40 µT beside a straight wire.

How it is calculated

µ₀ = 4π × 10⁻⁷ H/m is the magnetic constant. For another cross-section, multiply the inductance by the area in cm².

The principle

Both formulas come from Ampère's circuital law, which says that the magnetic field summed around a closed loop equals µ₀ times the current passing through the loop. For a straight wire, the field lines are circles around it, so B times the circumference 2πr equals µ₀I. For a long solenoid, the field inside is nearly uniform and parallel to the axis, and almost zero outside. A rectangular loop of length L that passes through the coil encloses N turns, giving B · L = µ₀NI. A core material multiplies the field by its relative permeability µr. Inductance follows because the flux through each turn is B · A and there are N turns linking it.

Worked example

  1. Inputs: I = 2 A, N = 500 turns, L = 0.2 m, r = 0.01 m, µr = 1.
  2. Turns per metre: 500 ÷ 0.2 = 2,500 /m.
  3. Solenoid field: 4π × 10⁻⁷ × 2,500 × 2 = 6.2832 × 10⁻³ T = 6.2832 mT.
  4. Wire field: 4π × 10⁻⁷ × 2 ÷ (2π × 0.01) = 4 × 10⁻⁵ T = 40 µT.
  5. Inductance: 4π × 10⁻⁷ × 500² × 10⁻⁴ ÷ 0.2 = 1.5708 × 10⁻⁴ H = 0.15708 mH.
How Solenoid field (mT) changes with Length (m)How Solenoid field changes with Length0510152025300.050.10.150.20.250.30.4Example: 6.283185307Length (m)
Each point is the calculator re-run with only “Length (m)” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Length (m)Solenoid field (mT)
0.0525.13274123
0.112.56637061
0.158.37758041
0.26.283185307
0.255.026548246
0.34.188790205
0.43.141592654

How to read the result

For comparison, Earth's magnetic field at the surface is roughly 25 to 65 µT, so a 2 A wire at 1 cm produces a field of the same order and can deflect a nearby compass. A few millitesla is typical of an air-core coil; iron-core electromagnets reach around 1 to 2 T before the core saturates.

Common mistakes

Keep in mind: These are idealised textbook results. Real coils have finite length, winding spread and core saturation, and real cables often carry return currents that cancel much of the field. For safety-critical exposure or engineering design, use measurements or detailed simulation.

Frequently asked questions

Does the field depend on the coil diameter?

For an ideal long solenoid, no. Only turns per metre, current and core matter.

What is the difference between tesla and gauss?

1 T = 10,000 G, so 40 µT equals 0.4 G.

Sources: CODATA recommended values of the fundamental physical constants, NIST (vacuum magnetic permeability µ₀) · D. J. Griffiths, Introduction to Electrodynamics, Cambridge University Press, chapter 5 · NOAA National Centers for Environmental Information, World Magnetic Model

Checked 8 Nov 2026. Standard textbook formulas in SI units, computed in your browser. For learning and estimates — real designs must follow your local codes and be checked by a qualified engineer.

🔬 All science & engineering tools →🌍 Calculators by country →