The two most critical magnetic field formulas for electrical design are the infinite straight wire equation, B = (μ₀ × I) / (2π × r), and the ideal solenoid equation, B = μ₀ × n × I. In both cases, the vacuum permeability constant (μ₀) is approximately 4π × 10⁻⁷ T·m/A. Whether you are calculating the stray field around a 400A DC busbar or designing the coil for a custom 12V relay, getting the geometry and unit conversions right is the difference between a working prototype and a melted power supply.
The Core Magnetic Field Formulas and Symbol Definitions
In practical electrical and electronics work, you rarely need the full Biot-Savart law calculus integrals. Instead, we rely on two derived formulas that cover 95% of bench and jobsite scenarios: the field around a long straight conductor (used for busbars, transmission lines, and PCB traces) and the field inside a solenoid (used for inductors, electromagnets, and relay coils).
B = (μ₀ × I) / (2π × r)
B = μ₀ × n × IAlternative form using total turns:
B = (μ₀ × N × I) / L
Below is the definitive symbol reference sheet. Keep this table handy when verifying your dimensional analysis.
| Symbol | Parameter | SI Unit | Engineering Notes |
|---|---|---|---|
| B | Magnetic Flux Density | Tesla (T) | Often measured in Gauss (1 T = 10,000 G) or milliTesla (mT) on the bench. |
| μ₀ | Vacuum Permeability | T·m/A (or H/m) | Approx. 4π × 10⁻⁷. NIST notes this is an experimentally determined value post-2019 SI redefinition, but 4π × 10⁻⁷ remains the standard engineering approximation. |
| I | Current | Amperes (A) | Must be DC or the instantaneous AC value. For AC RMS fields, use I_rms. |
| r | Radial Distance | Meters (m) | Distance from the exact center-axis of the conductor to the measurement point. |
| n | Turn Density | Turns/m (m⁻¹) | Calculated as N / L. Represents how tightly the coil is wound. |
| N | Total Turns | Dimensionless | Total number of wire loops in the solenoid. |
| L | Solenoid Length | Meters (m) | The physical length of the wound coil section, not the total wire length. |
Assumptions, Applicability, and Unit Pitfalls
Formulas in physics are derived under specific boundary conditions. If you ignore these assumptions, your calculated B will diverge wildly from what your gaussmeter reads on the bench.
When the Formulas Apply (and When They Don't)
- Straight Wire Assumption: The formula
B = (μ₀ × I) / (2π × r)assumes an infinitely long wire. In practice, this holds true if the distance r is less than 10% of the wire's total length, and you are measuring near the middle of the run. If you measure near the end of a busbar, the field strength drops to roughly half the calculated value. - Solenoid Assumption: The formula
B = μ₀ × n × Iassumes an infinitely long solenoid relative to its diameter. A good rule of thumb for OpenStax University Physics applications: the length L must be at least 10 times the coil diameter for the center field to match the ideal formula. It also assumes an air core; adding ferromagnetic materials changes the math entirely (covered in the FAQ).
Realistic Answer Magnitudes
A major sanity check in magnetic design is knowing what a realistic B value looks like. If your calculation yields 50 T for a DIY copper coil, you have a decimal error.
- Earth's Magnetic Field: ~25 to 65 μT (microtesla)
- Standard Fridge Magnet: ~5 mT (millitesla)
- Neodymium (N52) Magnet Surface: ~1.2 T to 1.4 T
- Medical MRI Machine: 1.5 T to 3.0 T
- Saturation Limit of Electrical Steel: ~1.6 T to 2.1 T (Pushing B beyond this in a transformer core yields massive heat and diminishing returns).
Unit Mistakes That Break the Math
- Forgetting to convert cm/mm to meters: If r is 5 cm, you must use 0.05 m. Plugging in "5" will make your field 100 times weaker than reality.
- Confusing N and n: n is turns per meter. If you have 500 turns crammed into 10 cm, n is 5,000 turns/m, not 500.
- Confusing B and H: Magnetic field strength (H) is measured in Amperes/meter and only accounts for the current geometry. Magnetic flux density (B) is measured in Tesla and accounts for the material's response. Do not mix them up when reading datasheets.
Worked Examples with Strict Unit Tracking
Let's run two common scenarios, tracking every unit to ensure dimensional consistency.
Problem 1: Stray Field from a DC Busbar
Scenario: You are routing a 400 A DC battery cable in an EV conversion. A sensitive Hall-effect current sensor is mounted 5 cm away from the center of the cable. What is the magnetic flux density (B) interfering with the sensor?
Step 1: Identify and convert variables.
I = 400 A
r = 5 cm = 0.05 m
μ₀ = 4π × 10⁻⁷ T·m/A
Step 2: Apply the straight wire formula.
B = (μ₀ × I) / (2π × r)
B = (4π × 10⁻⁷ T·m/A × 400 A) / (2π × 0.05 m)
Step 3: Cancel units and simplify.
The 'A' (Amperes) cancels out. The 'm' (meters) cancels out. We are left with Tesla (T).
The 'π' in the numerator and denominator cancels out.
B = (4 × 10⁻⁷ × 400) / (2 × 0.05)
B = (1.6 × 10⁻⁴) / 0.1
B = 1.6 × 10⁻³ T
Answer: 1.6 mT (or 16 Gauss). This is strong enough to saturate an unshielded analog Hall sensor, requiring physical relocation or magnetic shielding.
Problem 2: Designing an Air-Core Solenoid
Scenario: You are winding a custom air-core electromagnet for a sorting machine. You wrap 500 turns of 22 AWG magnet wire tightly over a 10 cm long PVC form. You drive it with 2 A of DC current. What is the field inside the coil?
Step 1: Calculate turn density (n).
N = 500 turns
L = 10 cm = 0.10 m
n = N / L = 500 / 0.10 = 5,000 turns/m
Step 2: Apply the solenoid formula.
I = 2 A
μ₀ = 4π × 10⁻⁷ T·m/A
B = μ₀ × n × I
B = (4π × 10⁻⁷ T·m/A) × (5,000 m⁻¹) × (2 A)
Step 3: Solve and track units.
The 'A' cancels. The 'm' and 'm⁻¹' cancel. We are left with Tesla.
B = 4π × 10⁻⁷ × 10,000
B = 4π × 10⁻³ T
B ≈ 12.56 × 10⁻³ T
Answer: 12.56 mT. Because this is an air core, the field is relatively weak. To increase it without burning up the 22 AWG wire (which would overheat at much higher currents), you must insert a ferromagnetic core.
Rearranged Forms for Design and Troubleshooting
On the bench, you rarely know B and need to find it. Usually, you have a target B (e.g., the pull-in threshold of a reed switch) and need to design the coil or set the current. Here are the algebraically rearranged forms for quick design calculations.
Straight Wire Rearrangements
- Solve for Current (I):
I = (B × 2π × r) / μ₀
Use case: Determining the minimum trip current for a custom magnetic circuit breaker at a specific sensor distance. - Solve for Distance (r):
r = (μ₀ × I) / (2π × B)
Use case: Calculating the minimum safe clearance between a high-current cable and a sensitive compass or magnetometer.
Solenoid Rearrangements
- Solve for Current (I):
I = B / (μ₀ × n)
Use case: Sizing the MOSFET and power supply for a target holding force. - Solve for Turn Density (n):
n = B / (μ₀ × I)
Use case: Selecting the correct wire gauge (AWG) to achieve the required turns-per-meter within your physical coil window. - Solve for Total Turns (N):
N = (B × L) / (μ₀ × I)
Use case: Programming an automated coil winder to hit a specific inductance/field target given a fixed bobbin length and max current.
When designing systems that generate fields above 5 mT, be aware of magnetic interference. Strong fields can erase magnetic stripe cards, corrupt unshielded EEPROM memory, and critically, interfere with pacemakers and implantable cardioverter-defibrillators (ICDs). Always post warning labels on high-field test jigs and keep them clear of metallic hand tools to prevent projectile hazards.
Frequently Asked Questions About Magnetic Field Formulas
How do magnetic field formulas change when using an iron core?
The base formulas assume a vacuum or air core (where relative permeability, μ_r, is essentially 1). When you insert a ferromagnetic core like electrical steel or ferrite, you multiply the vacuum permeability (μ₀) by the material's relative permeability (μ_r). The modified solenoid formula becomes B = μ₀ × μ_r × n × I. For typical silicon steel, μ_r is between 1,000 and 4,000, meaning your magnetic field increases by orders of magnitude. However, this only applies up to the material's saturation point (usually around 1.5 T to 2.0 T). Beyond saturation, μ_r drops toward 1, and the core behaves like air, causing current to spike and heat to build up.
Why does my calculated magnetic field not match my gaussmeter reading?
Discrepancies between theoretical B and measured B usually stem from three physical realities ignored by the ideal formulas. First, fringing effects: the field at the physical ends of a real solenoid is exactly half the strength of the field in the dead center. If you measure near the edge of the coil, your reading will be low. Second, probe alignment: Hall-effect gaussmeters are highly directional. If the probe is not perfectly orthogonal to the magnetic flux lines, it will only read the vector component it intersects. Third, AC vs DC: if you are driving the coil with PWM or AC, ensure your meter is set to read the correct metric (RMS vs. Peak) and that its sampling rate is high enough to capture the waveform.
What is the difference between magnetic flux density (B) and magnetic field strength (H)?
This is a frequent point of confusion in component datasheets. H (Magnetic Field Strength) is measured in Amperes per meter (A/m) and describes the "effort" applied by the current geometry, completely independent of the material inside the coil. B (Magnetic Flux Density) is measured in Tesla (T) and describes the actual resulting magnetic field, which includes the material's amplification. They are linked by the equation B = μ × H (where μ is the total permeability of the material). When designing transformer cores or inductors, you calculate H to ensure you don't exceed the core's saturation limit on the B-H curve.






