Home / Electrical Engineering / Magnetics / Magnetic Field of a Solenoid

Formula & Calculator

Magnetic Field of a Solenoid

A solenoid is a long coil of wire, like a spring. When current flows through it, a strong and nearly uniform magnetic field appears inside the coil. The field strength depends on the current and how many turns of wire there are per unit length. Doubling the current or packing twice as many turns doubles the field. Solenoids are used in relays, valves, and door locks.

Magnetics Solenoids

Magnetic Field of a Solenoid Calculator

Field inside a long solenoid: B = μ₀ · n · I, where n is turns per unit length and I is the current.

Inputs

Drag the handle (or focus it and press ↑/↓) to reorder. Scientific notation such as 2.5e3 is accepted. Pick any unit; conversion is automatic. The result is for a long solenoid, where the length is much larger than the diameter. Pick any unit; conversion is automatic.

Presets

Results

Enter values and press Calculate. Your answer will appear here.

Magnetic field vs. current

B grows in direct proportion to the current, and doubling the turns per metre doubles the field. The solid line is your solenoid, the dashed lines are half and double the turn density, and the dot is your result.

What is being calculated

Solenoid and its magnetic field A solenoid is a coil of wire carrying current I. Inside, the magnetic field B is strong and uniform along the axis. Outside, the field lines spread out and return, so the field is weak. B equals mu zero times turns per length n times current I. I B (inside) length ℓ, N turns, n = N / ℓ B = μ₀ · n · I weak fieldoutside

Reference values

Current (n = 1000 turns/m)BB in gauss

B = μ₀·n·I, so doubling the current doubles the field.

Typical core relative permeability μr (approximate)

Core materialμr
Vacuum1 (exactly)
Air≈ 1.0000004
Copper, aluminium≈ 1 (non-magnetic)
Nickel-zinc ferrite≈ 16 to 640
Pure iron (99.8 %)≈ 5,000 (peak)
Mu-metal≈ 20,000 to 50,000

Ferromagnetic μr depends strongly on field strength, treatment and frequency; use the manufacturer’s data.

Typical magnetic fields for scale (approximate)

SourceB
Earth’s surface≈ 25 to 65 µT
Fridge magnet≈ 5 mT
Clinical MRI scanner≈ 1.5 to 3 T
Strongest sustained lab magnets≈ 45 T

Unit conversions

QuantityConversion
Magnetic field1 T = 1,000 mT = 10⁶ µT = 10,000 G · 1 G = 100 µT
Turns per length1 /cm = 100 /m · 1 /mm = 1,000 /m · 1 /in = 39.37 /m
Current1 A = 1,000 mA · 1 kA = 1,000 A
Constantμ₀ ≈ 1.2566×10⁻⁶ H/m ≈ 4π×10⁻⁷ H/m

Formula

B = μ₀ · n · I
  • B: magnetic flux density inside the solenoid (T)
  • μ₀: permeability of free space ≈ 4π×10⁻⁷ H/m
  • n = N / ℓ: turns per unit length (turns/m)
  • I: current (A)

Example: n = 1000 turns/m and I = 2 A. B = 1.2566×10⁻⁶ × 1000 × 2 ≈ 2.513×10⁻³ T = 2.513 mT = 25.13 G.

This is the field inside an ideal long solenoid, where it is uniform and nearly zero outside. With a core, B = μ₀·μr·n·I. For a finite solenoid of length ℓ and radius R the on-axis field at the centre is B = μ₀·n·I·(ℓ/2) / √((ℓ/2)² + R²), and about half of the ideal value at the end. Advanced mode also gives the inductance L = μ₀·μr·N²·A/ℓ, the stored energy ½·L·I² and the energy density B²/(2μ). The formulas assume a uniform winding and a linear core.

References

How to Use This Tool

  1. Pick a preset, or enter the turns per unit length n and its unit.
  2. Enter the current I and its unit.
  3. In Advanced, enter the total turns and length instead, add the diameter for finite-length values, or a core permeability.
  4. Click Calculate.
  5. Read B in the highlighted result, check the warnings and the chart.

What This Tool Offers

  • Basic and Advanced modes on one calculation engine
  • Turn density, current, length and field unit conversion (T, mT, µT, nT, G)
  • Comparison with Earth’s field and energy density
  • N and length input, core permeability, finite-length centre and end fields, inductance and stored energy (Advanced)
  • Field-vs-current chart and labelled solenoid diagram
  • Reorderable inputs, presets and a mobile-friendly layout

Variables

Symbol Quantity Unit
B Magnetic flux density inside the solenoid T
μ₀ Permeability of free space (4π×10⁻⁷) H/m
n Number of turns per unit length turns/m
I Electric current through the solenoid A
N Total number of turns dimensionless
L Length of the solenoid m

What it means

The magnetic field inside a long solenoid (coil) is uniform and given by B = μ₀·n·I, where n is the number of turns per unit length (turns/m) and I is the current. The field is directed along the axis of the solenoid. This formula is derived from Ampere’s law and assumes the solenoid is infinitely long. In practice, the field near the centre is approximately uniform. Solenoids are used to generate controlled magnetic fields for electromagnets, relays, speakers, and magnetic resonance imaging (MRI). The magnetic field is independent of the solenoid’s cross‑sectional area. Example: A solenoid with 1000 turns per metre and a current of 2A produces B = 4π×10⁻⁷ * 1000 * 2 = 4π×10⁻⁴ = 1.257×10⁻³ T (≈1.26 mT). This is a moderate field, strong enough for many laboratory applications.

Worked example

Magnetic Field of a Solenoid – Practical Example

Real‑World
Scenario: A solenoid has 1000 turns, length 0.5 m, and carries 2 A. Find the magnetic field inside (assume air core).
ParameterValue
N1000
L0.5 m
I2 A
μ₀4π×10⁻⁷ H/m
FormulaB = μ₀·(N/L)·I
1n = N/L = 1000/0.5 = 2000 turns/m
2B = 4π×10⁻⁷ × 2000 × 2 = 4π×10⁻⁷ × 4000 = 1.6π×10⁻³ T
Final Design B ≈ 5.03 mT ✓ Uniform field inside
Why: The field inside a long solenoid is uniform and proportional to the product of turns per unit length and current.

Common mistakes

  • n: Number of turns per unit length – not total turns.
  • Units: n in turns/m, I in amperes → B in teslas.
  • Uniform field: Inside a long solenoid, the field is approximately uniform.
  • Core material: If a magnetic core is present, B = μ·n·I (where μ = μ₀·μ_r).
  • End effects: Near the ends, the field is weaker and non‑uniform.

Applications

The magnetic field inside a long solenoid is B = μ₀·n·I, where n is the number of turns per unit length. This formula is used to design electromagnets, inductors, and magnetic actuators. Engineers use it to determine the required current and turns to achieve a desired flux density, which is crucial for relay operation, magnetic recording, and magnetic resonance imaging. The uniform field of a solenoid also serves as a reference for calibrating magnetic sensors. By understanding this relation, professionals can design efficient and compact magnetic devices. This formula is fundamental to magnetic circuit design and educational physics.

  • Design of solenoids for actuators and relays
  • Inductor and transformer core design
  • Magnetic field generation for MRI and NMR
  • Calibration of magnetometers and Hall sensors
  • Educational demonstration of magnetic field