Since 2010 · Powering 2M+ tool runs every month
Since 2010
Add to Chrome

My Toolbox

Automatic Mode

No saved tools yet.

Go Premium
Related tools
Electric Field CalculatorRing and Field CalculatorCoulomb's Law CalculatorElectricity CalculatorZ-Transform Calculator
Home Page > Miscellaneous > Physics Calculators

Magnetic Field of Wire Calculator

Compute the magnetic field around a conductor with the Biot-Savart and Ampere laws for three geometries: an infinite straight wire, a circular loop on axis, and a finite or ideal solenoid with an optional ferromagnetic core.

Free to useNo sign-up requiredInstant Results
Magnetic Field of Wire CalculatorTry it now — free ▼
⚡ Quick examples
1 What do you want to find?
Pick the unknown — its input row hides itself automatically.
1 What do you want to find?
On-axis Biot–Savart. The unknown's input hides itself.
1 What do you want to find?
Ideal = long-coil approximation. Finite = exact on-axis B at the centre using the coil radius for the end correction.
2 Current I in the wire
Sign matters — a negative value flips the field direction (right-hand rule).
3 Distance r from the wire
Perpendicular distance to the wire. Must be greater than zero.
3 Loop radius R
Radius of the single circular loop carrying the current.
4 Axial distance z from loop center
z = 0 gives the field at the loop centre. Far away (z ≫ R) gives the magnetic-dipole approximation.
3 Number of turns N
Total number of wire turns wound around the solenoid.
4 Solenoid length L
Length along the solenoid axis. The turn density is n = N / L.
5 Coil radius R (finite model)
Average radius of the windings. Only used for the finite-length end correction.
Magnetic field B (only when B is NOT the unknown)
Choose tesla, mT, µT, nT or gauss — all converted internally.
μ Surrounding medium or core
Iron and mu-metal multiply the empty-coil field by hundreds to tens of thousands — until they saturate around 1.5 to 2 T.

Embed Magnetic Field of Wire Calculator Widget

About Magnetic Field of Wire Calculator

The Magnetic Field of Wire Calculator computes the magnetic flux density \( B \) produced by a current-carrying conductor for the three geometries that dominate every electromagnetism course: an infinite straight wire (\( B = \mu_0 \mu_r I / 2\pi r \)), a circular current loop on its axis (\( B(z) = \mu_0 \mu_r I R^{2} / [2(R^{2}+z^{2})^{3/2}] \)), and an ideal or finite solenoid (\( B = \mu_0 \mu_r n I \) for the long-coil limit; with a \( \cos\theta \) end-correction for finite length). Solve for any unknown — B, current I, distance r, loop radius R, axial position z, number of turns N, or solenoid length L — with full SI unit conversion (microamps to kiloamps, micrometres to kilometres, nanotesla to kilogauss), a built-in catalogue of ferromagnetic core materials (iron, ferrite, mu-metal, custom \( \mu_r \)), live SVG previews of the field lines, and a step-by-step LaTeX derivation. Every result is captioned with a real-world reference, from Earth's field (≈ 50 µT) and a fridge magnet (≈ 5 mT) up to a clinical MRI scanner (1.5 T) and pulsed laboratory magnets (above 1000 T).

How to Use This Magnetic Field of Wire Calculator

  1. Pick a geometry at the top. Straight wire uses Ampère's law for an infinite wire. Circular loop uses the on-axis Biot–Savart formula. Solenoid uses the long-coil Ampère result, with an optional finite-length cosine correction.
  2. Choose what to solve for. For a straight wire you can solve for B, I, or r. For a loop you can solve for B, I, R, or z. For a solenoid you can solve for B, I, N, or L. The matching input hides itself so you cannot accidentally over-constrain the problem.
  3. Type in the remaining values with your preferred units. Mixing units across rows is fine — every quantity is converted into SI internally.
  4. Pick the surrounding medium or core. Vacuum and air leave the field unchanged. An iron core multiplies the empty-coil field by roughly 5,000× — until the iron saturates above 1.5–2 T. Pick Custom µ_r for any other material.
  5. Press Calculate and read the field magnitude in tesla and gauss, the step-by-step derivation, an animated SVG of the field lines, and a real-world comparison.

What Makes This Calculator Different

Three geometries — one tool Most online calculators handle only the infinite straight wire. This one also computes the circular loop (Biot–Savart) and the solenoid (Ampère's law) in the same form, so you can switch geometry without leaving the page.
Solve for any unknown Pick B, I, r, R, z, N, or L as the unknown. The calculator rearranges the formula symbolically (or numerically when needed, e.g. cube-root for z on the loop axis) and hides the matching input so the problem is always well-posed.
Finite-solenoid end-correction Short solenoids do not satisfy the L ≫ R assumption of the textbook formula. Switch to the finite model and supply the coil radius — the calculator multiplies by \( \cos\theta = (L/2)/\sqrt{(L/2)^{2}+R^{2}} \) so the centre-field number matches the exact Biot–Savart result.
Ferromagnetic cores done right Vacuum, water, copper (diamagnetic), aluminium (paramagnetic), soft ferrite (µ_r ≈ 640), pure iron (µ_r ≈ 5000), and mu-metal (µ_r ≈ 50 000) presets, with a custom slot for any other µ_r ≥ 0. Notes warn when you push above the saturation flux density of real iron.
Live, animated SVG preview Each mode has its own preview: concentric field circles around a wire, dipole-style closed loops around a circular coil, and a uniform-inside / closed-outside picture for a solenoid. Animations switch direction by the sign of I.
Real-world reference labels Every result is captioned with the closest familiar reference: Earth's field (~ 50 µT), fridge magnet (~ 5 mT), MRI (1.5 T), pulsed lab magnet (~ 100 T), neutron star (~ 10¹⁰ T). At a glance you see whether your number is plausible or pathological.

The Three Formulas

Infinite straight wire — Ampère's law applied to a circular Amperian loop centred on the wire:

\[ B \;=\; \dfrac{\mu_0 \mu_r I}{2 \pi r} \]

Circular current loop, on its axis at distance z from the centre — Biot–Savart law integrated around the loop:

\[ B(z) \;=\; \dfrac{\mu_0 \mu_r I R^{2}}{2 \left(R^{2}+z^{2}\right)^{3/2}} \]

At the loop centre (z = 0) this reduces to \( B_0 = \mu_0 \mu_r I / (2R) \). For z ≫ R it approaches the magnetic-dipole far-field \( B \approx \mu_0 m / (2\pi z^{3}) \) with magnetic moment \( m = I\pi R^{2} \).

Solenoid — ideal long coil from Ampère's law:

\[ B \;=\; \mu_0 \mu_r n I, \qquad n = N / L \]

For a finite-length solenoid, the field at the centre on the axis is multiplied by the geometric correction \( \cos\theta = (L/2)/\sqrt{(L/2)^{2}+R^{2}} \), which approaches 1 only when \( L \gg R \).

Worked Example: Household Wire

  • 5 A flowing in a single straight wire, measured 5 cm away.
  • \( B = (4\pi \times 10^{-7}) \times 5 / (2\pi \times 0.05) = 2 \times 10^{-5}\) T = 20 µT.
  • For comparison, Earth's magnetic field at the surface is ≈ 50 µT — so a typical household appliance lead produces about 40% of the natural field at 5 cm away, which is why a compass needle wobbles when you bring it close to a powered wire.

Worked Example: Circular Loop at Its Centre

  • 2 A in a single loop of radius 10 cm, field measured at the loop centre (z = 0).
  • \( B = \mu_0 I / (2R) = (4\pi \times 10^{-7}) \times 2 / (2 \times 0.10) \approx 1.26 \times 10^{-5}\) T = 12.6 µT.
  • Already weaker than Earth's field at the surface — single-loop electromagnets are surprisingly inefficient unless you wind many turns into a coil (solenoid).

Worked Example: Air-Core Solenoid

  • 500 turns wound into a 20 cm long coil, carrying 5 A.
  • Turn density n = 500 / 0.20 = 2 500 turns/m.
  • \( B = \mu_0 n I = (4\pi \times 10^{-7}) \times 2500 \times 5 \approx 1.57 \times 10^{-2}\) T = 15.7 mT.
  • About 3× a fridge magnet (~ 5 mT). Add a soft-iron core (µ_r ≈ 5000) and the field jumps to about 78 T — well above iron's saturation, so in practice the iron caps out near 1.5–2 T.

Right-Hand Rule, in Three Forms

  • Straight wire: point your right thumb in the direction of the conventional current I; the fingers naturally curl in the direction of the B field around the wire.
  • Circular loop: curl the fingers of your right hand around the loop in the direction the current flows; the thumb points along B on the axis.
  • Solenoid: same as the loop — fingers follow the winding, thumb points along the field inside the coil (i.e. north end of the equivalent bar magnet).

Common Magnetic-Field Magnitudes

Scenario|B|Notes
Intergalactic magnetic field~ 10⁻⁹ nTThe faintest fields measured in astrophysics.
Brain (MEG signal)~ 10 fT – 1 pTDetectable only with SQUID magnetometers in shielded rooms.
Earth's surface field25 – 65 µTWhat a compass needle responds to.
5 A household wire at 5 cm≈ 20 µTComparable to Earth's field. Compasses wobble nearby.
Fridge magnet~ 5 mTStrong enough to lift small steel objects.
Modern neodymium magnet (surface)~ 1 TWill pinch fingers — handle with care.
Clinical MRI1.5 – 3 TWrenches loose iron objects across the room. The reason MRI rooms are strictly screened.
Research electromagnet (continuous)30 – 45 TLiquid-helium-cooled superconducting magnets at facilities like NHMFL.
Pulsed laboratory magnet≈ 100 TCapacitor-bank discharges lasting milliseconds.
Magnetar (neutron-star type)10¹⁰ – 10¹¹ TStrongest fields known in the universe — would erase a credit-card strip from the Moon.

Tips for Solenoid Design

  • Long & thin wins. The ideal-solenoid formula \( B = \mu_0 n I \) assumes L ≫ R. For short coils, switch to the finite model and supply the coil radius. The end-correction \( \cos\theta \) drops from 1 (when L → ∞) down to 0.7 around L ≈ R.
  • µ_r is not magic. Soft iron multiplies B by ≈ 5000 at low fields, but real iron saturates around 1.5–2 T. Above that, raising the current barely raises B and most of the energy goes into eddy losses and heat.
  • Pulsed > continuous for high fields. Continuous magnets cap around 45 T because of cooling. Pulsed magnets reach 100 T+ by discharging a capacitor bank for milliseconds — long enough to do physics, short enough to avoid melting.
  • Mind the ohmic budget. The power dissipated is \( P = I^{2} R_{\text{wire}} \). Doubling turns to double n at the same current quadruples the resistance (wire is now twice as long), so the heat goes up 4× even though B only goes up 2×.

Frequently Asked Questions

What is the formula for the magnetic field of a long straight wire?
\( B = \mu_0 I / (2\pi r) \), where \( \mu_0 = 4\pi \times 10^{-7}\) T·m/A is the vacuum permeability and r is the perpendicular distance to the wire. Multiply by the medium's relative permeability \( \mu_r \) when not in vacuum.

What is the magnetic field at the center of a circular current loop?
\( B_0 = \mu_0 I / (2R) \) at the geometric centre, where R is the loop radius. On the axis at distance z it generalizes to \( B(z) = \mu_0 I R^{2} / [2(R^{2}+z^{2})^{3/2}] \).

What is the magnetic field inside a solenoid?
For an ideal long solenoid, \( B = \mu_0 \mu_r n I \), where n = N/L is the turn density. Inside an ideal coil this field is uniform and parallel to the axis; outside, the field looks like a bar magnet's. The calculator also handles the finite-length correction when L is not much larger than the coil radius R.

How do I use the right-hand rule for a current?
For a straight wire, point your right thumb along the conventional current and your fingers curl in the direction of B. For a loop or solenoid, curl the fingers in the direction of current flow and the thumb points along the on-axis B field (equivalent to the bar-magnet north pole).

Does the surrounding medium change the magnetic field?
Yes. The vacuum permeability \( \mu_0 \) is replaced by \( \mu = \mu_0 \mu_r \) in any medium. Air, water, and most non-magnetic materials have µ_r ≈ 1. Iron and other ferromagnets have µ_r in the thousands, which is why electromagnets use iron cores. Diamagnetic materials like copper have µ_r slightly less than 1.

What is the difference between B and H?
B (in tesla) is the magnetic flux density, the quantity that appears in the Lorentz force law \( F = qv \times B \) and that this calculator reports. H = B/(µ_0 µ_r) is the auxiliary "magnetic field intensity" in A/m, useful when you want to separate the source current from the material response. Most physics courses use B; most materials-science contexts use H.

What is the difference between Biot–Savart and Ampère's law?
Biot–Savart gives the contribution from each tiny current element; integrate over the geometry. It always works but the integrals can be hard. Ampère's law gives a closed-form B only in symmetric geometries (infinite wire, infinite solenoid, toroid) but is much faster when symmetry helps. This calculator uses Ampère's law for the wire and the ideal solenoid; Biot–Savart for the loop and the finite-solenoid correction.

Can I solve for the current instead of B?
Yes. In every mode use the Solve for selector to pick the unknown. The calculator rearranges the formula and hides the unknown's input so you cannot over-constrain the problem.

Reference this content, page, or tool as:

"Magnetic Field of Wire Calculator" at https://MiniWebtool.com/magnetic-field-of-wire-calculator/ from MiniWebtool, https://MiniWebtool.com/

by miniwebtool team. Updated: 2026-05-17

Physics Calculators:

Top & Updated:

Depth of Field (DoF) CalculatorWire Gauge CalculatorDirection Field / Slope Field PlotterView all →
Home Page > Miscellaneous > Physics Calculators > Magnetic Field of Wire Calculator