A magnetic field calculator computes the magnetic field strength B (in Tesla and Gauss) for three common configurations: a straight current-carrying wire, a solenoid, and a circular loop. Each shows a Canvas diagram of the field lines.
Straight Wire Parameters
Solenoid Parameters
Circular Loop Parameters
Magnetic Field B
Field Line Diagram
How to Use the Magnetic Field Calculator
This calculator computes the magnetic field strength for three fundamental configurations used in introductory electromagnetism. Each tab shows the relevant formula, input fields, and a field line diagram drawn with the Canvas API.
Straight Wire
For a long straight wire carrying current I, the magnetic field at distance r is B = μ₀I/(2πr), where μ₀ = 4π×10⁻⁷ T·m/A. A wire carrying 10A at 5cm distance produces B = (4π×10⁻⁷ × 10) / (2π × 0.05) = 4×10⁻⁵ T = 40 μT. This is roughly the same magnitude as Earth's magnetic field at the surface (~25–65 μT depending on location).
Solenoid
Inside a solenoid, the field is uniform: B = μ₀nI, where n = N/L is the turns per meter. For 200 turns, 20cm long, carrying 2A: n = 1000 turns/m, B = 4π×10⁻⁷ × 1000 × 2 ≈ 2.5 mT. This is why solenoids are used as electromagnets — you can control the field strength by adjusting current and turns.
Circular Loop
At the center of a circular loop (x=0), B = μ₀I/(2R). Moving along the axis to distance x, the field decreases as B = μ₀IR²/(2(R²+x²)^(3/2)). Two coaxial loops separated by a distance equal to their radius (Helmholtz coil) produce a remarkably uniform field in the region between them — a common laboratory setup.
Reading the Field Line Diagrams
For the straight wire, concentric circles show that field lines encircle the wire. The wire cross-section shows the current direction (dot = out of page, cross = into page). For the solenoid, field lines run straight through the interior and loop around the outside — like a bar magnet. For the loop, field lines emerge from the center, arc around the loop, and return through the outside.
FAQ
What is the magnetic field around a straight wire?
A current-carrying wire creates a magnetic field that circles around it. The magnitude is B = μ₀I/(2πr), where μ₀ = 4π×10⁻⁷ T·m/A is the permeability of free space, I is the current in amperes, and r is the perpendicular distance from the wire. The field direction follows the right-hand rule: thumb points in current direction, fingers curl in field direction.
What is the magnetic field inside a solenoid?
Inside an ideal solenoid, the magnetic field is uniform and equal to B = μ₀nI, where n is the number of turns per meter and I is the current. For N total turns of length L, n = N/L. Outside an ideal solenoid, the field is approximately zero. Real solenoids have fringe fields at the ends.
How does a circular loop create a magnetic field?
A circular loop of radius R carrying current I creates a field along its axis: B = μ₀IR²/(2(R²+x²)^(3/2)), where x is the distance from the center. At the center (x=0), this simplifies to B = μ₀I/(2R). The field is strongest at the center and decreases along the axis.
What are typical magnetic field strengths?
Earth's surface: ~25–65 μT. Refrigerator magnet: ~5 mT. Neodymium magnet: ~1 T. MRI machine: 1.5–3 T. Large research magnets: up to 45 T. Neutron star surface: ~10⁸ T. A wire carrying 10A at 5cm distance produces about 40 μT — comparable to Earth's field.
Is this calculator free?
Yes, completely free with no signup required. All calculations run in your browser.
Is my data private?
Yes. All calculations run locally. No data is sent to any server.
What is the right-hand rule?
The right-hand rule for straight wires: point your right thumb in the direction of conventional current flow; your fingers curl in the direction of the magnetic field circles. For coils/solenoids: curl your right-hand fingers in the direction of current flow around the coil; your thumb points toward the north pole (direction of B inside).