Solenoid Magnetic Field Calculator

Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/6/2026

The magnetic field at the center of a long solenoid is calculated with B = µ0 × n × I, where n is the number of turns per meter and I the current in amps. For 500 turns over 20 cm with a current of 2 A, the field is about 6.28 millitesla (mT).

Explanation

A solenoid is a coil of conducting wire wound in a helix; passing an electric current through it creates an intense, remarkably uniform magnetic field at its center — the basic principle behind an electromagnet. Once this field is known, our transformer turns ratio calculator shows how a similar coil arrangement transfers electrical energy between two circuits. The formula B = µ0 × n × I is only exact for a "long" solenoid (whose length is significantly greater than its diameter): it neglects edge effects at the ends, where the real field is about half as strong as at the center. The factor n = N ÷ L (number of turns per meter of length) shows that packing more turns into the same length, or lengthening the wound wire without changing the total length, directly increases the field produced — which is why industrial electromagnets often use very densely wound coils. This magnetic field depends only on the current and the geometry of the winding, not on the material inside (unless it contains a ferromagnetic core, which strongly amplifies the field by a factor this vacuum/air formula doesn't account for). This principle, closely related to the electric-field relationships in Coulomb's law, is put directly to use in electromagnets, loudspeakers, electric motors, and magnetic resonance imaging (MRI), which uses superconducting solenoids to produce fields of several teslas.

Example: a 500-turn solenoid over 20 cm

Inputs

Number of turns: 500. Length: 0.2 m. Current: 2 A.

Calculation

n = 500 ÷ 0.2 = 2,500 turns/m. B = 4π×10⁻⁷ × 2,500 × 2 ≈ 0.00628 T = 6.28 mT.

Result

This solenoid produces a magnetic field of about 6.28 millitesla at its center.

Frequently asked questions

Why does the formula only work for a "long" solenoid?

The formula B = µ0 × n × I assumes the magnetic field is perfectly uniform along the whole length of the solenoid, which is only true at the center of a coil sufficiently long relative to its diameter. Near the ends of a real solenoid, the field gradually decreases to about half its central value — an edge effect this simplified formula doesn't model.

How can I increase a solenoid's magnetic field?

Three levers act directly on the formula: increase the number of turns (N), reduce the length of the winding for the same number of turns (thereby increasing n), or increase the current flowing through it (I). In practice, inserting a ferromagnetic core (such as soft iron) inside the solenoid amplifies the field much further, by a factor that can reach several hundred — an effect not covered by this formula, which applies to a solenoid in a vacuum or in air.

What is the difference from the field created by a single current loop?

A solenoid can be thought of as a stack of many identical current loops: each turn contributes a field that adds to the others inside the winding, which explains why a solenoid produces a much stronger and more uniform field than a single loop, for the same current.

Related resources