Skip to main content

Magnetic Field of a Straight Wire Calculator

Compute the magnitude of the magnetic field around an infinitely long, straight current-carrying wire at a perpendicular distance r from the wire.

Category: Physics

Magnetic Field of a Straight Wire Calculator Inputs

Enter values to calculate

Steady current flowing through the wire (A).

Perpendicular distance from the wire (m).

Enable JavaScript for interactive calculation and step-by-step results.

Magnetic Field of a Straight Wire Calculator Formula

Equation

B = (\mu_0 \, I)/(2 π \, r)

Excel Formula

=B=(_0I)/(2PIr)

Variables

  • Current I (A) — Steady current flowing through the wire (A).
  • Distance r from wire (m) — Perpendicular distance from the wire (m).

How the Magnetic Field of a Straight Wire Calculator Works

A current-carrying wire generates a magnetic field that circles the wire. For an infinitely long straight wire the field magnitude falls off as 1/r and its direction wraps around the wire following the right-hand rule.

The core relationship is B = \frac{\mu_0 \, I}{2 \pi \, r}. Typical inputs include Current I, Distance r from wire.

Enter your values in the magnetic field of a straight wire calculator above, review the step-by-step solution, and compare against the worked examples below so you can see how each input changes the result. This free online physics tool is built for homework, design checks, and professional verification.

Magnetic Field of a Straight Wire Calculator Theory & Explanation

Biot–Savart law

The differential contribution of a wire element to the magnetic field is

d\vecB = (\mu_0)/(4π) \, \fracI \, d\vec\ell × \hatrr^2

Ampère's law for an infinite wire

For an infinite straight wire carrying current I, integrating Biot–Savart (or applying Ampère's law to a circular loop of radius r) gives:

B = (\mu_0 \, I)/(2 π \, r)

Direction (right-hand rule)

Point the thumb of the right hand along the conventional current direction; the fingers curl in the direction of the magnetic field. The field is tangent to circles centered on the wire and lies in planes perpendicular to the wire.

Comparison to Earth's field

Earth's magnetic field is roughly 25–65 µT depending on location. A modest household current of 10 A at 5 cm produces about 40 µT — comparable in magnitude to Earth's field. Power transmission lines and even a fridge magnet can produce larger fields nearby.

Limits and validity

The infinite-wire formula assumes (a) DC or slowly time-varying current, (b) the wire is in vacuum or a uniform non-magnetic medium. In ferromagnetic materials the field inside the conductor may be very different, and skin effect at high frequencies changes the effective current distribution.

Field Direction and the Right-Hand Rule

The magnetic field of a straight wire forms closed circles around it — there is no start or end, because magnetic field lines never terminate on sources the way electric field lines do on charges. Point the thumb of your right hand along the conventional current and your fingers curl in the field direction.

Two consequences follow immediately. First, the field has no radial component, so a compass placed near a current-carrying wire aligns tangentially rather than pointing at it. Second, because the field circles the wire, reversing the current reverses the field everywhere. This is also why twisting a pair of wires carrying equal and opposite currents cancels the external field so effectively: at any distance large compared with the twist pitch, the two contributions nearly annul.

\oint \vecB· d\vecl = \mu_0 I_\textenclosed

Forces Between Parallel Currents

A second wire placed in this field feels a force, and the result is one of the tidiest in electromagnetism: parallel currents in the same direction attract, and antiparallel currents repel. The force per unit length falls off as 1/d.

This effect used to define the ampere itself — one ampere was the current that, in two infinitely long parallel wires one metre apart, produced a force of exactly 2×10^-7 N per metre. (The 2019 SI redefinition now fixes the elementary charge instead, but the relationship still holds.) The same force is a genuine engineering concern: busbars in a substation must be braced against fault currents, because a short-circuit surge of tens of kiloamps produces forces large enough to bend copper.

(F)/(L) = (\mu_0 I_1 I_2)/(2π d)

Magnitudes and Practical Comparisons

The permeability of free space, \mu_0 = 4π×10^-7\ \mathrmT\,m/A, makes these fields small. A 1 A current produces just 2 × 10⁻⁷ T at 1 m, and even 100 A at 1 cm gives only 2 mT.

For comparison: the Earth's field is roughly 50 µT, a refrigerator magnet about 5 mT, a clinical MRI scanner 1.5–3 T. So the field near household wiring is typically well below the Earth's own field, which is why a compass is barely disturbed by domestic circuits. To get a strong field from a modest current you must either wind many turns into a coil — a solenoid multiplies the field by the turns per unit length — or add a ferromagnetic core, which can raise the flux density by a factor of thousands. Keep the distance in metres and the current in amperes; a centimetre-for-metre slip is a factor of 100 here, not 10,000, because this law is inverse-first-power rather than inverse-square.

B = (\mu_0 I)/(2π r), \qquad \mu_0 = 4π×10^-7\ \mathrmT\,m/A

Magnetic Field of a Straight Wire Calculator Worked Examples

Worked Example

Inputs

  • current: 10
  • distance: 0.05

Result: magneticField: 0.00004 magneticFieldMicro: 40 direction: CCW when viewed from +z along current

Explanation

A long straight wire carrying 10 A produces B = (4π×10⁻⁷ × 10)/(2π × 0.05) = 4×10⁻⁵ T = 40 µT at 5 cm — comparable to Earth's magnetic field. Doubling the distance to 10 cm halves the field to 20 µT.

Second Scenario

Inputs

  • current: 13.5
  • distance: 0.05

Result: magneticField: 0.00004 magneticFieldMicro: 40 direction: CCW when viewed from +z along current

Explanation

This scenario uses different inputs (current = 13.5, distance = 0.05) to show how changing one variable affects the magnetic field of a straight wire result. Run the calculator above with these values to get the exact updated output with step-by-step work.

Common Magnetic Field of a Straight Wire Calculator Use Cases

  • Physics problem sets and labs
  • Engineering design checks
  • Unit and formula verification
  • Magnetic Field of a Straight Wire homework and study
  • Magnetic Field of a Straight Wire design and analysis

Magnetic Field of a Straight Wire Calculator FAQs

How do you know the direction of the field?

Use the right-hand rule. Curl the fingers around the wire in the direction you would rotate them to follow the field circulation; the thumb points in the direction of conventional current flow. This is the only geometric convention — magnetically, "positive" and "negative" both exist, but the curl is unambiguous.

Is the formula true for finite wires?

No. The 1/r formula applies to infinite (or sufficiently long) straight wires. For a finite wire segment the field is the same at large r but smaller near the ends; the exact field for a finite segment involves arctangent terms.

Is a charged wire the same as a current-carrying wire?

No. A current-carrying wire has a moving average charge density (drift electrons) but is electrically neutral overall. The static field outside an infinite neutral straight wire is zero; the magnetic field is non-zero because electrons drift. A truly charged wire has both electric and magnetic fields.

Why does the wire generate the field?

Moving charges experience the Lorentz force; the magnetic field is a relativistically consistent description of how moving charges affect each other. The right-hand rule captures the direction encoded in the cross product of velocity and position in the Biot–Savart formulation.

Why does the field fall off as 1/r rather than 1/r²?

A point charge spreads its influence over a sphere whose area grows as r², giving an inverse-square law. A long straight wire spreads its field over a cylinder whose circumference grows only as r, so the field falls off just one power of distance. The same geometric argument explains why an infinite charged line also produces a 1/r electric field.