The solenoid magnetic field calculator above returns the magnetic flux density on the axis of a current-carrying coil. Unlike the familiar B = μ0nI shortcut, it uses the exact on-axis expression for a solenoid of finite length, so it tells you the truth at the centre, at the ends, and at any point in between. The shortcut is a limiting case of that expression, and the page shows both so the gap between them is visible.
Arb Digital builds free physics calculators that keep the assumptions on the surface. The infinite-solenoid formula is taught first because it is clean, and it is the right answer deep inside a long coil. It is wrong at the ends of every coil, and it is wrong nearly everywhere in a short one, which is exactly where most people are trying to use it.
What This Solenoid Magnetic Field Calculator Does
It computes B, the magnetic flux density, in teslas — scaled automatically to millitesla or microtesla where that reads better. The inputs are the current, the number of turns, the wound length, the mean diameter, the relative permeability of whatever is inside the coil, and where on the axis you want the answer.
The grid gives four supporting figures. The infinite-solenoid value is what the textbook shortcut would have returned, so you can see the size of the error you would have made. The field at the end is a fixed reference point that is roughly half the centre value for any reasonably long coil. The turn density is the quantity that actually drives the field, as opposed to the raw turn count. The flux through the coil is B multiplied by the cross-sectional area, which is the quantity that matters when you are thinking about induced voltages rather than forces.
Everything on this page is on-axis. Off the axis the field inside a solenoid is close to uniform in the middle of a long coil and increasingly non-uniform near the ends and near the winding itself, and describing it properly needs a field solver rather than a formula.
How to Use It
- Enter the current the coil actually carries. Not the supply rating — the current, which for a DC coil is the applied voltage divided by the winding resistance.
- Enter the turns and the wound length. The ratio of these two is what sets the field. Two hundred turns spread over 200 mm produces exactly the same field as a hundred turns over 100 mm, for the same current.
- Enter the mean coil diameter. It does not appear in the infinite-solenoid formula at all, but it very much appears in the finite one, and it is what determines how quickly the field falls off near the ends.
- Set the permeability. Leave it at 1 for air. A ferromagnetic core raises the field, with the caveats in the section below.
- Choose where you want the answer. The centre is the maximum. The end is about half. A custom distance lets you trace the profile out beyond the mouth of the coil.
The Formula: How the Field Inside a Solenoid Is Calculated
For an infinitely long solenoid the field inside is uniform and equal to B = μ0 μr n I, where n = N ÷ l is the turns per unit length. OpenStax University Physics Volume 2, section 12.6 on solenoids and toroids, derives this from Ampère's law and shows why the field outside an ideal solenoid is zero.
For a real coil of length l and radius R, the on-axis field at a distance z from the centre is the sum of two half-angle terms:
B(z) = (μ0 μr n I ÷ 2) × [ (l/2 + z) ÷ √((l/2 + z)² + R²) + (l/2 − z) ÷ √((l/2 − z)² + R²) ]. Each bracket term is the cosine of the angle subtended by one end of the coil at the point of interest. As the coil gets very long both cosines approach 1, the bracket approaches 2, and the expression collapses to the familiar μ0nI.
The permeability of free space is a measured constant since the 2019 SI redefinition, and this tool uses NIST's CODATA value for the vacuum magnetic permeability, 1.25663706127 × 10−6 N/A².
Work the defaults through. Five hundred turns over 100 mm gives n = 5,000 turns per metre, so μ0nI = 1.25664 × 10−6 × 5,000 × 2 = 12.566 mT. With R = 15 mm and l/2 = 50 mm, each cosine term at the centre is 0.05 ÷ √(0.05² + 0.015²) = 0.9578, so the true centre field is 12.566 × 0.9578 = 12.04 mT. At the end one term goes to zero and the other becomes 0.1 ÷ √(0.1² + 0.015²) = 0.9889, giving 6.21 mT — almost exactly half.
Why the Field Halves at the End
The factor of two at the mouth of a solenoid is not a coincidence or an approximation; it falls straight out of the geometry. At the centre of a long coil, windings extend away in both directions and each side contributes a cosine term close to 1. Standing at one end, there is coil on only one side of you. One term is still close to 1 and the other has dropped to zero, so you get half the bracket and half the field.
This has a practical consequence that catches people constantly. Measuring at the mouth of a coil with a hall probe, because that is where the probe fits, and then comparing the reading against a centre calculation, produces an apparent 50 per cent error in the theory. The theory is fine; the measurement was taken somewhere else. Set the point selector to the end and the two agree.
What a Ferromagnetic Core Really Does
Multiplying by μr is the standard treatment, and it is a serious simplification. A ferromagnetic core raises the flux density enormously at low field strengths, but its permeability is not constant: it falls as the material approaches saturation, and beyond saturation the core contributes almost nothing further. A calculation that multiplies by a catalogue μr of 4,000 without checking the saturation flux density can predict a field that the material physically cannot support.
The geometry matters as much as the material. A closed magnetic circuit — a toroid, or a core with a small gap — behaves close to the bulk figure. An open rod inside a coil does not, because the return path runs through air and the air dominates the reluctance. The effective permeability of an open rod can be an order of magnitude below the material's bulk value, and it depends on the rod's length-to-diameter ratio. OpenStax University Physics Volume 2, section 12.7 on magnetism in matter, covers why permeability behaves this way.
Where This Sits Next to the Other Magnetics Tools
This page returns a field strength, which exists only while the current flows. The solenoid inductance calculator returns an inductance, which is a property of the coil's geometry and is there whether or not it is energised. The two are related but they answer different questions: the field tells you what force the coil exerts and what a probe would read, the inductance tells you how the coil behaves in a circuit.
The magnetic field of a wire calculator handles the third case, a single straight conductor, where there is no coil to concentrate the flux and the field falls as 1/r with distance instead of being roughly uniform. Between them, those three cover the three geometries that come up most often. For unit work, the magnetic field converter moves values between tesla, gauss and the rest.
To find the current in the first place, the Ohm's law calculator and the wire resistance calculator give you the winding resistance and the current a supply will push through it, and the power dissipation calculator tells you how much heat that current puts into the coil.
Arb Digital builds free tools like this one because useful pages earn attention. If you want tools, calculators or content built for your own audience, we can help.
Browse All Free Tools Talk to Arb DigitalCommon Mistakes to Avoid
- Using the infinite-solenoid formula on a short coil — it always reads high, and on a coil as wide as it is long the error is well over 20 per cent.
- Comparing an end measurement against a centre calculation — the field at the mouth is about half the field at the middle, so the two will never agree.
- Using turns instead of turns per metre — the field depends on the density of the winding. Spreading the same turns over twice the length halves the field.
- Multiplying by a catalogue permeability for an open core — an unclosed magnetic path gives a far lower effective permeability, often by a factor of ten or more.
- Ignoring saturation — once a ferromagnetic core saturates, extra current produces almost no extra flux density in it, and the linear multiplication stops being valid.
Related Free Tools From Arb Digital
Pair this with the solenoid inductance calculator for the circuit behaviour of the same coil, and the magnetic field of a wire calculator for a straight conductor. Convert results with the magnetic field converter. On the electrical side, the Ohm's law calculator, the wire resistance calculator and the power dissipation calculator cover the current and the heat, and the inductor energy calculator gives the energy stored in the field. Everything Arb Digital publishes is on the free online tools hub.
Frequently Asked Questions
Turns per metre. A coil with a hundred turns over 100 millimetres and one with two hundred turns over 200 millimetres produce the same field for the same current, because the turn density is identical. The total turn count matters for the inductance and the resistance, not for the field strength.
Because at the centre there is winding on both sides contributing to the field, and at the end there is winding on only one side. In the exact formula each side contributes a cosine term, and at the end one of those terms falls to zero. For a long coil the remaining term is close to one, so the result is almost exactly half.
It is zero for an ideal infinite solenoid, which is a useful idealisation and not a real object. A finite coil has a genuine external field that closes the loop from one end round to the other, like a bar magnet. It is much weaker than the internal field but it is not nothing, and it is what lets you detect a coil from outside it.
Within the central portion of a long coil it is uniform to well under one per cent. Uniformity degrades towards the ends, and by the mouth of the coil the field has already dropped to about half. A rough guide is that the central third of a coil five diameters long is uniform enough for most laboratory work.
Air-cored coils at safe currents typically produce a few millitesla to a few tens of millitesla. Getting into the hundreds of millitesla requires either a ferromagnetic core, serious current with active cooling, or both, because the heat dissipated goes with the square of the current.
No. A toroid has no ends, so the finite-length correction does not apply, and its field varies with radius inside the core rather than being uniform. It needs its own formula based on the mean magnetic path length.
The usual causes are a lower current than assumed once the winding has warmed and its resistance risen, a probe that is not exactly on the axis or exactly at the point you calculated, or an open core whose effective permeability is far below the material figure. Winding pitch errors are a smaller but real contributor.
This tool is provided for educational and preliminary design use. It gives the on-axis field only, does not model core saturation, winding pitch or off-axis positions, and does not address the safety of strong magnetic fields near medical implants or sensitive equipment.