Skip to the content
Find a formula

Formula of Magnetic Field

Electricity and magnetism formulasVectorClass 12Updated 1 Nov 2026

B=μ0I2πrB = \frac{\mu_0 I}{2\pi r}
SI unit
T (tesla)
Dimensions
[M¹ T⁻² I⁻¹]
where
  • B magnetic field (flux density) T
  • μ₀ permeability of free space, 4π × 10⁻⁷ T m/A
  • I current in the wire A
  • r perpendicular distance from the wire m

The formula of magnetic field near a long straight wire is B=μ0I2πrB = \frac{\mu_0I}{2\pi r}: the field grows with the current I and weakens as you move a distance r away. Here μ0=4π×10−7\mu_0 = 4\pi\times10^{-7} T m/A, so μ02π\frac{\mu_0}{2\pi} is exactly 2 × 10⁻⁷ in SI units, which makes quick sums easy.

There is no single formula for every magnetic field. The answer depends on the shape of the current: a straight wire, a circular loop or a long coil. This page gives the three results Class 12 and AP Physics 2 students use most, with a worked example of each, then the right hand rule for direction.

Quick facts

  • Straight wire

    B=μ0I2πrB = \frac{\mu_0I}{2\pi r}
  • Centre of a loop

    B=μ0NI2RB = \frac{\mu_0NI}{2R}
  • Inside a solenoid

    B=μ0nIB = \mu_0nI
  • Constant

    μ₀ = 4π × 10⁻⁷ T m/A
  • SI unit

    tesla (T)
  • Dimensions

    [M¹ T⁻² I⁻¹]
  • Direction

    Right hand thumb rule: thumb along I, fingers curl with B

Symbols in the formula of magnetic field

Quantities in B = μ₀I / (2πr)
SymbolMeaningSI unit
BBField magnitude at the pointT
μ0\mu_0Permeability of free spaceT m/A
IICurrent in the long wireA
rrShortest distance from the wire to the pointm

Field lines around a straight wire are circles centred on it. Double the current and B doubles; double the distance and B halves. The field never reaches zero, it just keeps fading. This result comes from Ampere's circuital law, or from the Biot Savart law integrated along the wire.

Three standard current shapes

Field formulas for wires, loops and coils
Current shapeFieldWhere
Long straight wireμ0I2πr\frac{\mu_0I}{2\pi r}Distance r from the wire
Circular coil, N turns, radius Rμ0NI2R\frac{\mu_0NI}{2R}At the centre
Long solenoid, n turns per metreμ0nI\mu_0nIInside, away from the ends
Toroid, N turns, mean radius rμ0NI2πr\frac{\mu_0NI}{2\pi r}Inside the core

For a solenoid, n is turns per unit length: total turns divided by length. Well away from its ends, a long solenoid gives a B that hardly varies from point to point, which is why coils are used to make steady fields in labs.

Examples with full working

Example 1: a straight cable

A long wire carries 10 A. Find the field 5.0 cm from it.

r = 0.050 m.

B=(2×10−7)(10)0.050=4.0×10−5 TB = \frac{(2\times10^{-7})(10)}{0.050} = 4.0\times10^{-5}\ \text{T}

That is close to the strength of Earth's own field.

Example 2: a solenoid

A solenoid 25 cm long has 500 turns and carries 2.0 A. Find the field inside.

n = 500 / 0.25 = 2.0 × 10³ turns per metre.

B=(4π×10−7)(2000)(2.0)≈5.0×10−3 TB = (4\pi\times10^{-7})(2000)(2.0) \approx 5.0\times10^{-3}\ \text{T}

Example 3: centre of a flat coil

A coil of 50 turns and radius 10 cm carries 0.50 A. Find B at its centre.

B=(4π×10−7)(50)(0.50)2(0.10)≈1.6×10−4 TB = \frac{(4\pi\times10^{-7})(50)(0.50)}{2(0.10)} \approx 1.6\times10^{-4}\ \text{T}

Finding the direction

Grip the wire with your right hand, thumb pointing along the conventional current. Your curled fingers show the direction of the field circles. For a loop or solenoid, curl your fingers with the current around the coil; your thumb then points along the field inside, toward the end that acts as a north pole.

In diagrams, a dot means a field coming out of the page and a cross means a field going into it.

Units and dimension of magnetic field

From F=BILF = BIL, the tesla equals N/(A m). Breaking down the newton gives [M¹ T⁻² I⁻¹], with length cancelling out. Open the dimensional formula of magnetic field for the derivation. Because B is also flux per area, the same unit appears on the magnetic flux density page.

Mistakes seen in exams

  • Using the loop formula for a straight wire, or the reverse. Check the shape first.
  • Taking n as the total number of turns in a solenoid. It is turns per metre.
  • Forgetting 2π in the straight wire formula.
  • Mixing μ₀ = 4π × 10⁻⁷ with 10⁻⁷; the 4π matters.

Fields act on moving charges through the Lorentz force, and on current loops through their magnetic moment. Browse the electricity formula hub for the rest of the chapter.

Frequently asked questions

What is the formula of magnetic field due to a straight wire?

B = μ₀I / (2πr), with μ₀ = 4π × 10⁻⁷ T m/A. Since μ₀/2π is 2 × 10⁻⁷, you can write B = 2 × 10⁻⁷ I / r.

What is the formula of magnetic field inside a solenoid?

B = μ₀nI, where n is the number of turns per metre. It is nearly uniform inside a long solenoid.

Which unit measures magnetic field?

The tesla (T). Small fields are often given in mT, μT or in gauss, where 1 T = 10⁴ gauss.

Does a magnetic field have a direction?

Yes, B is a vector. Around a wire its direction follows the right hand thumb rule.

Why does the field fall with distance from a wire?

The field lines form circles around the wire. A larger circle spreads the same field over a longer path, so B falls as 1/r.