The magnetic field coil formula is the foundational bridge between electrical current and magnetic force. Whether you are winding a custom relay, designing a metal detector search coil, or sizing an electromagnet for a DIY project, calculating the exact flux density inside the coil dictates your wire gauge, turn count, and core material. The direct answer for the magnetic flux density (B) inside an ideal solenoid is:
B = μ0 × μr × (N × I) / L
Below is the complete derivation framework, symbol definitions, real-world data, and step-by-step worked examples to apply this formula on the bench.
The Magnetic Field Coil Formula & Symbol Definitions
To use the formula accurately, every variable must be tracked in strict SI units. The formula calculates the magnetic flux density (B) along the central axis of a tightly wound, cylindrical coil (solenoid).
| Symbol | Parameter | SI Unit | Typical Value / Constant |
|---|---|---|---|
| B | Magnetic Flux Density | Tesla (T) | Target output variable (e.g., 0.001 T to 2.0 T) |
| μ0 | Permeability of Free Space | T·m/A | 4π × 10-7 (approx. 1.2566 × 10-6) [NIST CODATA] |
| μr | Relative Permeability of Core | Dimensionless | 1 (Air/Vacuum), ~2000 (Silicon Steel), ~10,000 (Mu-metal) |
| N | Total Number of Turns | Dimensionless | Integer count of wire wraps (e.g., 100 to 10,000) |
| I | Current through the Coil | Amperes (A) | DC or RMS AC current (e.g., 0.05 A to 50 A) |
| L | Length of the Coil | Meters (m) | Physical length of the wound section, not the wire length |
Assumptions, Unit Traps, and Realistic Magnitudes
When the Formula Applies (and When It Fails)
This formula assumes an ideal, infinitely long solenoid. In practice, it is highly accurate when the coil length (L) is at least 10 times greater than its diameter (D). If you are winding a short, fat coil (L ≈ D), the field at the center is weaker than the formula predicts. For short coils, you must multiply the result by the Nagaoka coefficient (K), a dimensionless correction factor derived from elliptic integrals that accounts for edge effects [HyperPhysics].
Unit Mistakes That Break the Math
- Centimeters instead of Meters: Entering L = 10 (for 10 cm) instead of 0.1 m will make your calculated B-field 100 times too small.
- Gauss vs. Tesla: 1 Tesla = 10,000 Gauss. If a datasheet specifies a core saturates at 15,000 Gauss, your target B in the formula must be 1.5 T.
- Wire Length vs. Coil Length: L is the physical length of the cylinder the wire is wrapped around, not the total unspooled length of the copper wire.
Realistic Answer Magnitudes
Before calculating, sanity-check your result against these benchmarks: Earth's magnetic field is ~50 μT (0.00005 T). A standard fridge magnet is ~5 mT (0.005 T). A heavy-duty industrial lifting electromagnet operates around 1.5 T to 2.0 T. If your air-core calculation yields 5 Tesla, you have a math error or a melted coil.
| Application | Turns (N) | Current (I) | Length (L) | Core (μr) | Calculated B (T) |
|---|---|---|---|---|---|
| DIY Metal Detector (Air Core) | 150 | 0.5 A | 0.02 m | 1 (Air) | 0.0047 T (4.7 mT) |
| 12V Automotive Starter Relay | 800 | 1.2 A | 0.04 m | 2000 (Steel) | 1.206 T |
| Industrial Solenoid Valve | 2500 | 0.8 A | 0.05 m | 1500 (Iron) | 1.130 T |
| MRI Main Magnet (Superconducting) | 5000 | 120 A | 1.50 m | 1 (Air/Vacuum) | 0.502 T (per section)* |
*Note: MRI magnets use complex multi-section geometries and persistent currents; the single-solenoid formula is simplified here for baseline comparison.
Rearranged Forms for Component Sizing
On the workbench, you rarely solve for B. Usually, you know the magnetic force you need (which dictates B), and you need to size the wire, the power supply, or the physical bobbin. Here are the rearranged forms:
- Solve for Current (I):
I = (B × L) / (μ0 × μr × N)
Use when: Sizing a DC power supply or selecting a MOSFET driver for a known coil. - Solve for Turns (N):
N = (B × L) / (μ0 × μr × I)
Use when: Winding a custom bobbin with a fixed current limit and physical length. - Solve for Coil Length (L):
L = (μ0 × μr × N × I) / B
Use when: Determining how much space a required magnetic field will consume on a PCB or chassis.
Worked Examples with Unit Tracking
Problem 1: Sizing an Air-Core Coil for a DIY Project
Scenario: You are building a magnetic stirrer and wind 400 turns of 22 AWG magnet wire around a 15 cm long PVC pipe. You plan to drive it with 3 Amps of DC current. What is the magnetic flux density at the center of the coil?
Step 1: Identify and convert variables to SI units.
- N = 400
- I = 3 A
- L = 15 cm = 0.15 m
- μr = 1 (PVC and air are non-magnetic)
- μ0 = 1.2566 × 10-6 T·m/A
Step 2: Plug into the formula.
B = (1.2566 × 10-6) × 1 × (400 × 3) / 0.15
B = (1.2566 × 10-6) × (1200 / 0.15)
B = (1.2566 × 10-6) × 8000
B = 0.01005 Tesla (or 10.05 mT)
Bench Insight: 10 mT is roughly twice the strength of a fridge magnet. For a magnetic stirrer, this is likely too weak to spin a flea through a thick glass beaker. You would need to add a soft iron core (μr ≈ 1000) to push this into the 10 T range, which leads directly into saturation limits.
Problem 2: Calculating Required Current for a Custom Electromagnet
Scenario: You need a custom magnetic lock that generates exactly 1.2 Tesla to hold a steel plate. The coil bobbin is 5 cm long, and you have space for 600 turns. You are using a silicon steel core with a relative permeability of 2,500. What current is required?
Step 1: Identify variables.
- Target B = 1.2 T
- L = 5 cm = 0.05 m
- N = 600
- μr = 2500
Step 2: Use the rearranged formula for Current (I).
I = (B × L) / (μ0 × μr × N)
I = (1.2 × 0.05) / (1.2566 × 10-6 × 2500 × 600)
I = 0.06 / (1.2566 × 10-6 × 1,500,000)
I = 0.06 / 1.8849
I = 0.0318 Amps (31.8 mA)
Bench Insight: Only 31.8 mA is needed to generate a massive 1.2 T field because the high-permeability core does the heavy lifting. However, this assumes the core's μr stays at 2,500. At 1.2 T, silicon steel begins to approach its saturation knee, meaning μr will drop, and you will likely need 40-50 mA in reality to achieve the full 1.2 T.
Real-World Design Limits: Core Saturation & Thermal Constraints
The magnetic field coil formula is mathematically linear: double the current, double the B-field. Physical reality is not linear. When designing coils for >0.5 T, you must account for two major non-linear failure modes.
1. Core Saturation (The B-H Curve Knee)
Ferromagnetic materials (iron, steel, ferrite) amplify the magnetic field by aligning their internal magnetic domains. Once all domains are aligned, the core is saturated. For standard electrical silicon steel, saturation occurs around 1.5 T to 2.0 T. For soft ferrites (used in high-frequency switch-mode power supplies), saturation occurs much lower, typically around 0.3 T to 0.4 T [Coilcraft Design Tools].
If your formula calculates a B-field of 4.0 T using an iron core, the math is lying to you. The core will saturate at ~1.8 T, and any additional current will only generate heat, behaving as if the core were air (μr drops to 1). Always check the manufacturer's B-H curve for your specific core alloy.
2. Thermal Limits and Wire Sizing
Pushing high current through tight coil windings generates I²R (Joule) heating. A coil with 500 turns of 28 AWG wire might mathematically require 2 Amps to hit your target B-field, but 28 AWG wire is only rated for ~1.4 A for chassis wiring.
The Fix: If your required current exceeds your wire's ampacity, you must increase the wire diameter (lower AWG number). Because thicker wire takes up more physical space, you will have to increase the coil length (L) or reduce the turn count (N) to fit the same bobbin, forcing you to recalculate the entire formula. Always iterate your design between the magnetic formula and a standard wire ampacity chart.






