Magnetic Field of Wire Calculator
Compute the magnetic field B around a current-carrying conductor using the Biot–Savart law and Ampère's law. Three geometries in one tool: an infinite straight wire, a circular current loop (on-axis), and a finite or ideal solenoid with optional ferromagnetic core. Solve for B, current I, distance r, loop radius R, axial position z, turns N, or solenoid length L, with a live SVG that draws the encircling field lines, the right-hand-rule direction, and the inside-vs-outside field strength side-by-side with real-world references (Earth, fridge magnet, MRI, neutron star).
Your ad blocker is preventing us from showing ads
MiniWebtool is free because of ads. If this tool helped you, please support us by going Premium (ad‑free + faster tools), or allowlist MiniWebtool.com and reload.
- Allow ads for MiniWebtool.com, then reload
- Or upgrade to Premium (ad‑free)
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
- 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.
- 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.
- Type in the remaining values with your preferred units. Mixing units across rows is fine — every quantity is converted into SI internally.
- 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.
- 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
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⁻⁹ nT | The faintest fields measured in astrophysics. |
| Brain (MEG signal) | ~ 10 fT – 1 pT | Detectable only with SQUID magnetometers in shielded rooms. |
| Earth's surface field | 25 – 65 µT | What a compass needle responds to. |
| 5 A household wire at 5 cm | ≈ 20 µT | Comparable to Earth's field. Compasses wobble nearby. |
| Fridge magnet | ~ 5 mT | Strong enough to lift small steel objects. |
| Modern neodymium magnet (surface) | ~ 1 T | Will pinch fingers — handle with care. |
| Clinical MRI | 1.5 – 3 T | Wrenches loose iron objects across the room. The reason MRI rooms are strictly screened. |
| Research electromagnet (continuous) | 30 – 45 T | Liquid-helium-cooled superconducting magnets at facilities like NHMFL. |
| Pulsed laboratory magnet | ≈ 100 T | Capacitor-bank discharges lasting milliseconds. |
| Magnetar (neutron-star type) | 10¹⁰ – 10¹¹ T | Strongest 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// from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: 2026-05-17