Magnetic Field Calculator
A current-carrying coil or wire produces a magnetic field whose strength follows directly from Ampere's law. Inside a long solenoid the field is nearly uniform and equals the permeability of free space times the turns per meter times the current. Around a long straight wire the field falls off inversely with distance. Enter the current, the solenoid's turns and length, and a distance from a straight wire, and this calculator returns the solenoid field and the wire field, expressed in tesla, microtesla, and gauss.
Magnetic field formulas
mu0 = 4 pi * 10^-7 T m / A
Turns per meter n = turns / length
Solenoid field B = mu0 * n * current
Straight wire field B = mu0 * current / (2 pi * distance)
1 tesla = 10,000 gauss = 1,000,000 microtesla
The solenoid result assumes a long, tightly wound coil in air. The wire result assumes a long, thin straight conductor. Both come directly from Ampere's law.
Magnetism context
- The solenoid field is essentially uniform inside and very weak outside a long coil.
- The straight-wire field decreases with distance, so doubling the distance halves the field.
- Earth's magnetic field at the surface is roughly 25 to 65 microtesla.
- A ferromagnetic core multiplies the field by its relative permeability, often hundreds or more.
- The tesla and gauss both measure magnetic flux density; 1 tesla equals exactly 10,000 gauss.
Magnetic field calculator: frequently asked questions
How do I calculate the magnetic field inside a solenoid?
For a long solenoid the field inside is B = mu0 times n times I, where mu0 is the permeability of free space, n is the number of turns per meter (total turns divided by length), and I is the current in amperes. This calculator computes n from your turns and length, then multiplies by mu0 and the current.
What is the value of mu0?
The permeability of free space, mu0, has the conventional value 4 pi times 10 to the minus 7 tesla meters per ampere, which equals about 1.25664 times 10 to the minus 6. Since the 2019 SI redefinition it is a measured quantity extremely close to this value; the difference is far below the precision of any practical magnet calculation.
How is the field around a straight wire different?
Around an infinitely long straight wire the field is B = mu0 times I divided by 2 pi r, where r is the distance from the wire. It falls off with distance, unlike the roughly uniform field inside a solenoid. This calculator reports the wire field at the distance you enter for comparison.
What units does the result use?
The field is given in tesla (T), the SI unit. Practical fields are often small, so the calculator also shows the value in microtesla (one millionth of a tesla) and gauss, where 1 tesla equals 10,000 gauss. Earth's surface field is around 25 to 65 microtesla for reference.
Does this account for a magnetic core?
No. These formulas assume air or vacuum. A ferromagnetic core multiplies the field by the core's relative permeability, which can be hundreds or thousands. If you have a core, multiply the result by its relative permeability, a property of the core material.
Official sources
Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.