Solenoid Magnetic Field Calculator
A solenoid is a coil of wire wound in a helix. When current flows through it, a nearly uniform magnetic field is created inside. For an ideal long solenoid with n turns per meter carrying current I, the field inside is B = mu0 * n * I, where mu0 = 4*pi*10^-7 T m/A. This formula is used to design electromagnets, inductors, MRI gradient coils, and relay actuators. Enter the number of turns, coil length, and current; the calculator derives n and computes B.
Solenoid magnetic field formula
B = mu0 * mu_r * n * I
n = N / L (turns per meter)
mu0 = 4*pi * 10^-7 T m/A = 1.2566 * 10^-6 T m/A
Example: N = 500 turns, L = 0.25 m, I = 2 A, air core (mu_r = 1): n = 2,000 turns/m, B = 1.2566e-6 * 1 * 2,000 * 2 = 0.005026 T (about 5 milliteslas).
Solenoid applications
- Relay actuators: a solenoid generates a magnetic field that pulls an iron plunger, switching an electrical contact.
- MRI machines use superconducting solenoids carrying hundreds of amps to produce fields of 1.5 to 7 T for imaging.
- Inductors in switching power supplies are solenoids whose inductance L = mu0 * mu_r * n^2 * A / length, where A is cross-sectional area.
- Linear motors and solenoid valves for fluid control rely on the attractive force between the solenoid field and a ferromagnetic core.
Frequently asked questions
What is the magnetic field inside a solenoid?
Inside a long solenoid, the magnetic field is approximately uniform and given by B = mu0 * n * I, where mu0 = 4*pi*10^-7 T m/A is the permeability of free space, n is the number of turns per meter, and I is the current in amperes.
What is mu0 (permeability of free space)?
mu0 = 4*pi * 10^-7 T m/A = approximately 1.2566 * 10^-6 T m/A. It is the magnetic constant relating current to magnetic field in a vacuum. Since the 2019 SI redefinition, mu0 is a measured quantity close to this value.
How do you calculate turns per meter from total turns and length?
n = N / L, where N is the total number of turns (coils) and L is the solenoid length in meters. For example, 500 turns over 0.25 m gives n = 500 / 0.25 = 2,000 turns/m.
Does the formula apply to the entire solenoid?
The formula B = mu0 * n * I applies to the interior of an ideal (infinitely long) solenoid. At the ends, the field is approximately half (B/2). For a practical solenoid at least 10 times longer than its diameter, the center field is within a few percent of the ideal formula.
What is the field inside a solenoid with a magnetic core?
With a ferromagnetic core, replace mu0 with mu = mu_r * mu0, where mu_r is the relative permeability of the core material (hundreds to thousands for iron). This greatly amplifies the field, which is why electromagnets use iron cores.
Official sources
- NIST CODATA: NIST Value of Permeability of Free Space.
- OpenStax University Physics: Magnetic Field of a Solenoid, Vol. 2 Ch. 12.
Reviewed by the CalculatorHub team, edited by James Graham, 15 June 2026. See our methodology.