Skip to content
Omnikalc

Magnetic field of a straight wire, a solenoid or a circular coil

Calculate the magnetic field created by an electric current in a long straight wire, inside a solenoid or at the center of a flat coil.

Updated on
Your inputs
Configuration
A

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Results

Magnetic field

25.13 mT

In tesla
0.02513 T
In gauss
251.3 G
Compared with Earth's field (about 50 µT)
502.7 ×
Similar to a fridge magnet

Currents make magnetic fields

Hans Christian Ørsted discovered in 1820 that a compass needle swings near a wire carrying current. Every electric current creates a magnetic field around it, and shaping the wire into loops or coils concentrates that field. This calculator covers the three classic shapes.

The formulas

With μ₀ = 1.2566 × 10⁻⁶ T·m/A, the permeability of free space:

Configuration Field
Long straight wire, at distance r B = μ₀ × I ÷ (2π × r)
Inside a long solenoid of length L with N turns B = μ₀ × N × I ÷ L
Center of a flat circular coil of radius R with N turns B = μ₀ × N × I ÷ (2R)

The solenoid formula assumes the coil is much longer than it is wide; near the ends, the field drops to about half. All formulas assume air or vacuum around the wire.

Worked example

A solenoid with 200 turns wound over 10 cm and carrying 10 A:

Result Value
Magnetic field 25.13 mT
In tesla 0.02513 T
In gauss 251.3 G
Compared with Earth’s field about 500 times

The same 10 A in a single straight wire gives only 0.1 mT at 2 cm, about twice Earth’s field. Winding the wire into a coil multiplies the effect.

Typical field strengths

Source Field
Earth’s magnetic field 25–65 µT (about 0.5 G)
Near a household appliance cable a few µT
Fridge magnet 5–10 mT
Neodymium magnet surface 0.5–1.3 T
Hospital MRI scanner 1.5–3 T

Increasing the field

  • More turns or more current raise the field in proportion, but more current also means more heat in the wire (P = I² × R).
  • A shorter, denser winding raises the field inside a solenoid.
  • An iron core can multiply the field by several hundred until the iron saturates around 1.5 to 2 T. This is how electromagnets, relays and transformers work, and it is not included in these air-core formulas.

Safety note

The fields from household wiring are tiny. Strong electromagnets and MRI-level fields can pull steel objects violently and affect pacemakers, so treat high-current coils with care.

Frequently asked questions

How do you calculate the magnetic field of a solenoid?

Inside a long solenoid, B = μ₀ × N × I ÷ L, where N is the number of turns, I the current and L the length. 200 turns over 10 cm carrying 10 A give about 25 mT.

What is the field around a straight wire?

At a distance r from a long straight wire, B = μ₀ × I ÷ (2πr). A 10 A current gives 0.1 mT at 2 cm, about twice Earth's magnetic field.

What is μ₀?

μ₀ is the magnetic permeability of free space, about 1.2566 × 10⁻⁶ T·m/A. Air behaves almost exactly like vacuum. An iron core can multiply the field by hundreds or thousands, which these formulas do not include.

How do tesla and gauss compare?

1 tesla equals 10,000 gauss. Earth's field is about 0.5 gauss (50 µT), a fridge magnet about 50 to 100 gauss, and a hospital MRI scanner 1.5 to 3 tesla.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.