The Solenoid Magnetic Field Formula

When you are winding custom inductors, building linear actuators, or designing electromagnets for relay circuits, you need to know exactly how much magnetic flux density your coil will generate. The foundational equation for the magnetic field inside an ideal solenoid is:

B = μ0 × μr × (N / L) × I

Symbol Definition Table

Symbol Parameter SI Unit Typical Bench Values
B Magnetic Flux Density Tesla (T) 0.001 T to 1.5 T
μ0 Vacuum Permeability (Magnetic Constant) T·m/A 4π × 10-7 (approx. 1.2566 × 10-6)
μr Relative Permeability of Core Material Dimensionless 1 (air), 2000 (1018 steel), 10000 (silicon steel)
N Total Number of Turns Dimensionless (count) 50 to 5,000 turns
L Length of the Solenoid Coil Meters (m) 0.01 m to 0.5 m
I Current through the Wire Amperes (A) 0.1 A to 20 A

When This Formula Applies (and Its Assumptions)

This equation assumes an ideal solenoid. In practice, this means the length of the coil (L) must be significantly greater than its diameter (typically L > 10 × diameter). If you are winding a short, fat coil—like a 2 cm long coil with a 3 cm diameter—this formula will overestimate the center magnetic field by up to 20% due to fringing. For short coils, you must multiply the result by the Nagaoka coefficient to correct for the geometry. Furthermore, this formula calculates the field exactly at the center axis; the field strength drops to roughly half at the physical ends of the coil.

Unit Mistakes That Break the Calculation

The most common way hobbyists and students brick these magnetism calculations is through unit mismanagement:

  • Using centimeters for L: The formula strictly requires meters. Plugging in '5' for a 5 cm coil instead of '0.05' will skew your result by a factor of 100.
  • Confusing N and n: Some textbooks write the formula as B = μnI, where n is turn density (turns per meter). If you use total turns (N) in the n version without dividing by length, your math will fail.
  • Forgetting μ0: The 4π × 10-7 constant is non-negotiable for SI units. If you are working in CGS (Gauss and Oersteds), the constants change entirely. Stick to SI (Teslas and Amperes) for all bench work.

Realistic Answer Magnitudes

When you finish your calculation, sanity-check your answer against these real-world benchmarks. If your math says your DIY 12V electromagnet generates 15 Tesla, you have a decimal error.

Source Magnetic Flux Density (B)
Earth's Magnetic Field~50 μT (0.00005 T)
Standard Refrigerator Magnet~5 mT (0.005 T)
Typical DIY Air-Core Actuator10 mT to 30 mT
N42 Neodymium Magnet (Surface)~1.2 T to 1.4 T
Iron Core Saturation Limit~1.6 T to 2.1 T
Clinical MRI Machine1.5 T to 3.0 T

Reference: For exact physical constants and magnetic unit definitions, consult the NIST CODATA fundamental constants database.

Rearranged Forms for Electromagnet Design

On the bench, you rarely know all variables and just solve for B. Usually, you have a target magnetic field and need to size your power supply or wind a specific number of turns. Here are the algebraically rearranged forms for design work:

  • Solve for Current (I): Use this to size your bench power supply or select a MOSFET for PWM driving.
    I = (B × L) / (μ0 × μr × N)
  • Solve for Total Turns (N): Use this to determine how much magnet wire to buy and how many layers to wind on your bobbin.
    N = (B × L) / (μ0 × μr × I)
  • Solve for Coil Length (L): Use this when you are constrained by a specific wire gauge and current, and need to find how tightly to pack the turns.
    L = (μ0 × μr × N × I) / B
  • Solve for Relative Permeability (μr): Use this to identify what core material (e.g., M19 silicon steel vs. powdered iron) is required to hit your target field without saturating.
    μr = (B × L) / (μ0 × N × I)

Worked Examples with Unit Tracking

Let's run through two practical scenarios. We will use the standard vacuum permeability constant μ0 ≈ 1.2566 × 10-6 T·m/A to keep the intermediate steps readable. (For deeper theoretical background on solenoid fields, refer to Georgia State University's HyperPhysics solenoid module).

Example 1: Calculating the B-Field of an Air-Core Actuator Coil

Scenario: You are building a custom voice coil actuator. You wind 400 turns of 24 AWG magnet wire tightly over a 5 cm long plastic bobbin. You drive it with 2.5 A from a bench supply. What is the magnetic field inside?

  1. Identify and Convert Variables:
    • N = 400 turns
    • L = 5 cm = 0.05 m (Crucial conversion)
    • I = 2.5 A
    • μr = 1 (Air/plastic core)
    • μ0 = 1.2566 × 10-6 T·m/A
  2. Calculate Turn Density (N/L):
    • n = 400 / 0.05 m = 8,000 turns/m
  3. Apply the Formula:
    • B = μ0 × μr × n × I
    • B = (1.2566 × 10-6) × 1 × 8,000 × 2.5
    • B = (1.2566 × 10-6) × 20,000
  4. Final Computation:
    • B = 0.025132 T
    • B ≈ 25.1 mT

Bench Note: 25.1 mT is a solid field for a small air-core actuator, but it will not pick up heavy steel objects. You need a ferromagnetic core to multiply this by μr.

Example 2: Sizing Current for an Iron-Core Lifting Magnet

Scenario: You want to build an electromagnet that generates 0.8 T (a safe operating point below the ~1.6 T saturation limit of 1018 carbon steel). Your steel core is 10 cm long, and you have already wound 500 turns of 22 AWG wire. The effective relative permeability (μr) of your specific steel at this operating point is 2,000. How much current do you need?

  1. Identify and Convert Variables:
    • B = 0.8 T
    • L = 10 cm = 0.1 m
    • N = 500 turns
    • μr = 2,000
    • μ0 = 1.2566 × 10-6 T·m/A
  2. Select the Rearranged Formula for Current:
    • I = (B × L) / (μ0 × μr × N)
  3. Compute the Numerator (B × L):
    • 0.8 T × 0.1 m = 0.08 T·m
  4. Compute the Denominator (μ0 × μr × N):
    • (1.2566 × 10-6) × 2,000 × 500
    • (1.2566 × 10-6) × 1,000,000 = 1.2566 T·m/A
  5. Final Computation:
    • I = 0.08 / 1.2566
    • I ≈ 0.0636 A (or 63.6 mA)

Bench Note: While the math says you only need 63.6 mA to magnetize the steel core itself, this pure solenoid formula ignores the air gap in your magnetic circuit. If you are using this magnet to pick up a scrap piece of metal across a 2 mm air gap, the reluctance of that gap will require significantly more current (often 5x to 10x more) to achieve the same flux density in the gap.

Frequently Asked Questions

How do magnetism calculations change for a toroidal core?

In a straight solenoid, the magnetic field is relatively uniform along the center axis. In a toroid (a donut-shaped core), the magnetic field is entirely contained within the core, but it is not uniform. The field is stronger on the inner diameter and weaker on the outer diameter. The formula becomes B = (μ0 × μr × N × I) / (2π × r), where r is the specific radial distance from the center of the toroid. For practical design, engineers usually calculate the field at the mean radius (halfway between the inner and outer walls).

Why does my calculated magnetic field not match my gaussmeter reading?

If your theoretical math says 0.5 T but your AlphaLab gaussmeter or SS49E Hall effect sensor reads 0.3 T, you are likely hitting one of three physical realities: 1. Core Saturation: The formula assumes μr is constant. In reality, as steel approaches 1.5 T, its permeability drops drastically toward 1. The formula overestimates the field because it assumes linear material behavior. 2. Fringing and Edge Effects: If you measure near the ends of the solenoid rather than the exact dead-center, the field strength drops off sharply. 3. Sensor Placement: Hall sensors measure the field perpendicular to their surface. If the sensor is tilted even 15 degrees off-axis relative to the magnetic flux lines, your reading will drop by the cosine of that angle.

What is the difference between magnetic field (B) and magnetic field strength (H)?

This is a frequent point of confusion in electromagnet design. H (Magnetic Field Strength) is measured in Amperes per meter (A/m) and represents the raw magnetizing force generated purely by your coil's current and geometry (H = N × I / L). It does not care what material is inside the coil. B (Magnetic Flux Density), measured in Teslas, is the actual resulting magnetic field that includes the amplification effect of the core material. They are linked by the equation B = μ × H (where μ is the absolute permeability, μ0 × μr). You design the coil to provide H, but you measure B to see if it will pick up a load.

How does temperature affect these magnetism calculations?

Temperature attacks your design from two sides. First, as the copper magnet wire heats up from I²R losses, its electrical resistance increases by roughly 0.393% per °C. If you are driving the coil with a constant-voltage power supply (rather than constant-current), a 50°C temperature rise will increase resistance by ~20%, dropping your current (I) and proportionally dropping your B-field. Second, the relative permeability (μr) of ferromagnetic cores fluctuates with temperature, and if the core reaches its Curie temperature (e.g., 770°C for pure iron, but practically much lower for specific alloys), μr collapses to 1, and your electromagnet instantly becomes an air-core coil.