Solenoid Magnetic Field Calculator – B = μ₀nI Inside a Coil
Use this free Solenoid Magnetic Field Calculator to find the field inside a solenoid (a long coil of wire) from its number of turns, its length and the current, using B = μ₀nI.
A solenoid is the engineer's answer to a simple problem: a single wire's field is feeble and wrapped uselessly around the wire, but wind that wire into a tight helix and something remarkable happens. Inside the helix, the fields of hundreds of turns all point the same way and add; outside, they largely cancel. The result is a strong, straight, almost perfectly uniform magnetic field filling the coil's interior — a bar magnet's field, but switchable, adjustable, and available on demand. It is hard to name a technology that does not use one: door locks, fuel injectors, MRI scanners, particle accelerators and the starter motor that cranks a car all begin here.
The formula is striking for what it does not contain. B depends on the current I and on n, the number of turns packed into each metre — and on nothing else. Not on the coil's diameter, not on its total length (provided it is long compared with its width), not on the wire's thickness. Wind 1,000 turns over half a metre or over a metre and you get different solenoids with different fields, because n changed; but two coils with the same turns-per-metre and the same current make the same interior field even if one is fat and one is thin. The product nI even has its own informal name — ampere-turns per metre — and it is the single number solenoid designers trade in.
The scale of what is achievable climbs quickly. A modest bench solenoid, like the one in Example 1, makes about 5 mT — a hundred times the Earth's field, from a couple of amps. Multiply nI by ten and you are at 50 mT; add an iron core, which magnetises and contributes its own field, and the same coil can pass a tesla, though the iron eventually saturates and stops helping. At the far end sit superconducting solenoids: MRI scanners hold 1.5–3 T steady for years, and research magnets exceed 20 T, fields a million times stronger than the Earth's, all governed by the same three-letter formula on this page.
Formula
B = μ₀ × n × I, where n = N ÷ L is the number of turns per metre • B in tesla (T), I in amps (A), μ₀ = 4π × 10⁻⁷ H/m. Note: inside a long solenoid the field is strong and almost perfectly uniform, while just outside it is very weak (nearly zero) — the field is "stored" inside the coil.
Written out in full, B = μ₀NI ÷ L. The rearrangements plan real coils: I = B ÷ (μ₀n) finds the current a wound coil needs for a target field; n = B ÷ (μ₀I) finds the winding density a given power supply demands (Example 4 works this through); and N = BL ÷ (μ₀I) gives the total turns to wind on a former of length L. If an iron core of relative permeability μr fills the coil, multiply by μr: B = μrμ₀nI — until the iron saturates around 1.5–2 T and the multiplier stops growing (Example 6). One caution lives inside the letter n: it is turns per metre of coil length, so a coil's field is set by how tightly it is wound, and stretching the same turns over twice the length halves the field.
| Symbol | Meaning | Units |
|---|---|---|
| B | field inside the solenoid | tesla (T) |
| N | total number of turns | — (a count) |
| L | length of the wound coil | metres (m) |
| n | turns per metre, n = N/L | turns/m |
| I | current in the wire | amps (A) |
| μ₀ | permeability of free space, 4π × 10⁻⁷ | H/m |
Why the field is uniform — and where the formula comes from
Picture one loop of the coil: it makes a field through its centre, as the loop calculator shows. Now stack loops along an axis. Deep inside the stack, a point on the axis receives contributions from loops on both sides, near and far, and by symmetry the sideways components cancel while the axial components add to the same total no matter where along the middle you stand — that is the uniformity. Outside the coil the return field spreads through a huge volume, so it is diluted to almost nothing: the solenoid concentrates its field the way a pipe concentrates water flow.
The clean derivation uses Ampère's law: run a rectangular path partly inside the coil, parallel to the axis, and partly outside where the field is negligible. The law says the field times the inside length equals μ₀ times the total current threaded by the path — which is the current in each turn times the number of turns the path encloses, n × length × I. The lengths cancel, leaving B = μ₀nI exactly, with no mention of radius. That cancellation is also the formula's limit: it assumes the outside field is truly negligible and the winding truly tight, i.e. a long solenoid. Short, fat coils leak field at their ends and fall short of the prediction — which is why the ends of even a good solenoid sit at about half the central value, the subject of FAQ 2 below.
How to use
- Enter N, the total number of turns wound on the solenoid — count them, or divide the coil length by the wire's diameter (including insulation) for a single tight layer.
- Enter L, the length of the wound section in metres — the length over which the turns are spread, not the former's total length.
- Enter the current I in amps.
- Click "Calculate": the calculator works out n = N/L and returns B in tesla and millitesla. The value is the field at the centre of a long solenoid with an air (or vacuum) core.
- For an iron core, treat the result as a lower bound: multiply by the core's effective μr (often a few hundred) but cap the total near the iron's saturation of roughly 1.5–2 T.
Worked examples
Example 1 — a bench solenoid. A solenoid has 1000 turns wound over a length of 0.5 m and carries 2 A.
Turns per metre: n = 1000 ÷ 0.5 = 2000 turns/m.
B = μ₀nI = 4π × 10⁻⁷ × 2000 × 2 = 0.00503 T = 5.03 mT.
That is about 100 times stronger than the Earth's field — and sliding an iron core inside would multiply it further still.
Example 2 — a shorter coil, same winding density. A coil of 500 turns over 0.25 m carries 1 A.
n = 500 ÷ 0.25 = 2000 turns/m — the same density as Example 1, but half the current.
B = 4π × 10⁻⁷ × 2000 × 1 = 0.00251 T = 2.51 mT. Exactly half of Example 1: with n fixed, B simply tracks I.
Example 3 — a densely wound coil. 2000 turns over 0.4 m, carrying 3 A.
n = 2000 ÷ 0.4 = 5000 turns/m.
B = 4π × 10⁻⁷ × 5000 × 3 = 0.0188 T = 18.8 mT. Nearly four times Example 1 from 2.5× the density and 1.5× the current — the two factors multiply.
Example 4 — designing for a target field. How many turns per metre are needed to reach 0.1 T with a supply limited to 5 A?
n = B ÷ (μ₀I) = 0.1 ÷ (4π × 10⁻⁷ × 5) = 15,900 turns/m (about 15.9 turns in every millimetre — very fine wire, many layers). On a 0.5 m former that means roughly 7,960 turns. This is why strong air-core solenoids are bulky: the turns-per-metre bill must be paid in copper.
Example 5 — the MRI scanner's appetite. An MRI magnet holds 1.5 T. The required ampere-turns per metre are
nI = B ÷ μ₀ = 1.5 ÷ (4π × 10⁻⁷) = 1.19 × 10⁶ A/m — over a million ampere-turns in each metre. No copper coil can carry that without melting, which is why MRI magnets are superconducting: once started, their current circulates for years with no power supply at all.
Example 6 — adding an iron core. The Example 1 solenoid (5.03 mT air-core) is filled with an iron core of μr ≈ 300 at this field level.
B ≈ 300 × 0.00503 = 1.51 T — three hundred times the field for the same current, landing right at the edge of iron's saturation. This is the electromagnet trick: the coil's modest field magnetises the iron, and the iron's own field does the heavy lifting.
Solenoids in real life
Solenoid valves and locks. In the device that shares the name, the coil's field drags an iron plunger into its centre — field becomes motion. Fuel injectors, washing-machine water valves, door locks and pinball flippers are all this: B = μ₀nI pulling on iron.
Starter motors. The "solenoid" on a car starter is a beefy coil whose field throws the pinion gear into the flywheel and closes the main contacts — a few dozen turns of thick wire, huge current, decisive mechanical action.
MRI scanners. Example 5's million ampere-turns per metre, wound from superconducting niobium-titanium and bathed in liquid helium, produce the most uniform large-volume field humans make — uniform to parts per million, so that proton signals map the body faithfully.
Particle accelerators and fusion. Accelerator beamlines steer and focus with solenoid lenses; tokamaks and stellarators confine plasma with toroidal and poloidal field coils that are, in essence, solenoids bent into rings.
Relays and contactors. A small coil's field pulls an armature that closes contacts carrying far larger currents — the solenoid as an electrically operated switch, isolating a delicate control circuit from a brutal power circuit.
Scientific electromagnets. Laboratories needing a known, steady, uniform field — for calibrating magnetometers, testing Hall sensors, or cancelling the Earth's field — reach for the solenoid first, because its field is calculable from a current measurement alone, via this very formula.
How much field can a solenoid make? The ladder from bench to MRI
Because B is just μ₀ × (nI), every solenoid ever built sits on one ladder, ranked by its ampere-turns per metre. A school coil at nI = 4,000 A/m (Example 1) makes 5 mT. A serious air-core laboratory magnet at nI = 100,000 A/m makes 0.126 T — and dumps kilowatts of heat doing it, since copper's resistance turns most of the input into warmth. Iron cores cheat the ladder by up to a few hundred times, but saturation caps them near 2 T. Beyond that, only superconductors climb: MRI at nI ≈ 1.2 × 10⁶ A/m (1.5 T), and the strongest steady research fields on Earth, around 45 T in hybrid magnets, at nI ≈ 3.6 × 10⁷ A/m with megawatts of cooling. The formula never changes; only the engineering budget does.
There is a second budget hiding behind the first: stored energy. A magnetic field carries energy density u = B² ÷ (2μ₀), which at 1.5 T is (1.5)² ÷ (2 × 4π × 10⁻⁷) ≈ 9 × 10⁵ J/m³ — nearly a megajoule in every cubic metre of field. An MRI magnet's bore and winding hold several megajoules in total, comparable to the energy of a kilogram of TNT, stored silently and indefinitely while the magnet is in persistent mode. That is why a quench — the sudden loss of superconductivity — is treated with respect: the megajoules come out as heat in seconds, boiling off the helium in a roaring cloud. The gentle formula B = μ₀nI sits on top of a great deal of bottled energy.
Quick reference: field vs ampere-turns per metre
| nI (A/m) | B = μ₀nI | Typical device |
|---|---|---|
| 1,000 | 1.26 mT | small relay coil |
| 2,000 | 2.51 mT | demonstration coil at 1 A |
| 4,000 | 5.03 mT | Example 1's bench solenoid |
| 10,000 | 12.6 mT | strong school electromagnet (air core) |
| 100,000 | 0.126 T | water-cooled laboratory magnet |
| 1,190,000 | 1.5 T | MRI scanner (superconducting) |
The pattern to remember: each factor of ten in nI buys exactly a factor of ten in B. There are no shortcuts in the formula itself — only in materials, which is what cores and superconductors are.
Common mistakes
- Using N where n belongs. The formula needs turns per metre. 1,000 turns spread over 2 m is n = 500, not 1,000 — forgetting the division by L overstates the field by the coil's whole length.
- Entering L in centimetres. L must be in metres for n to come out per metre. A 50 cm coil entered as 50 gives a field fifty times too small.
- Expecting the diameter to matter. For a long solenoid it does not: B = μ₀nI has no radius in it. A wider coil of the same n and I makes the same central field (though it takes more wire and stores more energy).
- Applying the centre value at the ends. At each open end the field is about half the central value, and outside it falls away fast. Instruments placed at a solenoid's mouth are not in the field the calculator reports.
- Multiplying by μr without the saturation cap. An iron core multiplies the field only until the iron saturates near 1.5–2 T. Beyond that, extra current adds field at the air-core rate, and a naive μr multiplication promises fields the iron cannot deliver.
FAQ
Why is the field uniform inside a solenoid?
The fields of all the loops add up along the axis and cancel outside. Deep inside a long solenoid every point "sees" the same arrangement of loops, so the field has the same strength and direction everywhere — ideal for experiments needing a steady, known field.
What happens at the ends of the solenoid?
Right at each open end the field is about half its central value, because loops are missing on one side. The formula B = μ₀nI is most accurate for the middle of a long, tightly wound solenoid.
How can the field be made stronger?
Increase the current, pack in more turns per metre, or insert a ferromagnetic core such as iron — the core becomes magnetised and can boost the field hundreds of times. That is how electromagnets and MRI scanners are built.
Which end is the north pole?
The end the field lines emerge from. Grip the coil with your right hand, fingers curling with the current through the turns; your thumb points along the internal field, towards the north end. Reverse the current and the poles swap.
Does the coil's diameter affect the field?
Not for a long solenoid — B = μ₀nI contains no radius. Diameter does affect how much wire you need, the coil's resistance and inductance, and how "long" the coil effectively is: a short, fat coil leaks field and falls below the formula, while a long, thin one matches it well.
What limits the current in a real solenoid?
Heat. The wire's resistance turns electrical power into heat at I²R, and insulation fails if the winding gets too hot. Practical solenoids are rated by how much current they can carry continuously, intermittently, or — with water cooling or superconductors — almost without limit.
How is a solenoid different from a single loop?
A loop concentrates its field near one plane, with B = μ₀I/(2R) at its centre falling off along the axis. A solenoid is that loop repeated along an axis so the strong region stretches into a uniform tunnel of field — and its strength is set by turns per metre rather than by 1/R.
Why do MRI scanners hum and knock?
The main field comes from the steady solenoid, but gradient coils — smaller solenoids switched rapidly to encode position — flex under the magnetic forces between coils (F = BIL at enormous scale). The knocking is those coils being hammered by their own field thousands of times per scan.
Can a solenoid's field be turned off instantly?
No — a coil is an inductor, and its current (hence field) can only change as fast as the circuit lets the stored energy leave. Big magnets are ramped up and down over minutes, and a sudden "quench" in a superconducting magnet dumps the stored energy as heat in seconds, by design, to protect the coil.
What is the field just outside a solenoid?
Very weak compared with inside — the return field spreads through all the space around the coil instead of a narrow bore, so it dilutes to near the level of a bar magnet's stray field, strongest near the ends. That contrast, strong inside and weak outside, is exactly what makes solenoids useful.