Electromagnetism

Magnetic Force on a Wire

F = I·L × B — current-carrying wires in magnetic fields experience force

A current-carrying wire in a magnetic field experiences force — F = I·L × B (force = current times length cross magnetic field). This is the basis of all electric motors. Two parallel current-carrying wires attract or repel depending on direction. Force per unit length F/L = μ₀·I₁·I₂/(2π·r). Used to define the ampere historically.

  • Force on wireF = I · L × B
  • MagnitudeF = I·L·B·sin θ
  • Two parallel wiresSame direction → attract; opposite → repel
  • F/L between wiresμ₀·I₁·I₂/(2π·r)
  • Used inMotors, loudspeakers, electromagnetic relays
  • μ₀4π × 10⁻⁷ T·m/A (vacuum permeability)

Interactive visualization

Press play, or step through manually. The visualization is yours to drive — try it before reading on.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

Force on a wire

For a wire carrying current I, of length L, in magnetic field B:

F = I · L × B

Magnitude: F = I·L·B·sin θ, where θ is the angle between L (wire direction) and B.

Direction: by right-hand rule (if conventional current flows in direction of L).

GeometryForce
Wire perpendicular to BF = I·L·B (max)
Wire at angle θ to BF = I·L·B·sin θ
Wire parallel to BF = 0

Parallel current-carrying wires

Two parallel wires, separated by distance r, carrying currents I₁ and I₂:

F/L = μ₀ · I₁ · I₂ / (2π · r)
  • Currents in SAME direction → attractive force.
  • Currents in OPPOSITE direction → repulsive force.
  • μ₀ = 4π × 10⁻⁷ T·m/A.

For 1 A in each wire, 1 m apart:

F/L = 4π × 10⁻⁷ × 1 × 1 / (2π × 1) = 2 × 10⁻⁷ N/m

(This historically defined the ampere.)

Real-world applications

SystemUse of force on wire
DC motorCurrent loop in B field experiences torque; rotates
AC induction motorRotating B field induces currents in rotor; rotor follows
LoudspeakerVoice coil in B field of permanent magnet; audio current vibrates cone
GalvanometerCoil in B field rotates with current; needle indicates
Maglev trainRepulsion between train coils and rail magnets levitates
Linear motorSame physics as rotary motor, unrolled
RailgunForce on current-carrying armature accelerates projectile
Mass spectrometerLorentz force separates ions by mass

JavaScript — force on wire calculations

const mu_0 = 4 * Math.PI * 1e-7;

// Force on a wire segment
function forceOnWire(I, L, B, angle_deg = 90) {
  return I * L * B * Math.sin(angle_deg * Math.PI / 180);
}

// 5 A in 0.5 m wire perpendicular to 0.5 T
console.log(`${forceOnWire(5, 0.5, 0.5)} N`); // 1.25 N

// Force per unit length between parallel wires
function parallelWireForce(I1, I2, distance) {
  // F/L = μ_0 · I1·I2 / (2π·r)
  return mu_0 * I1 * I2 / (2 * Math.PI * distance);
}

console.log(`Two 100A wires 10cm apart: ${(parallelWireForce(100, 100, 0.10) * 1000).toFixed(2)} mN/m`);

// Loudspeaker driver: typical voice coil
function speakerForce(I, B = 1.0, coil_length = 0.05) {
  // Voice coil ~ 0.5 m of wire (multiple turns), B ~ 1 T from permanent magnet
  return I * coil_length * B;
}

console.log(`Speaker at 1A: ${speakerForce(1)} N`);  // 0.05 N — small but pushes a light cone fast

// Motor torque on a loop
function motorTorque(I, area, B, angle_to_B_normal_deg) {
  // τ = m × B = I·A·B·sin(θ)
  return I * area * B * Math.sin(angle_to_B_normal_deg * Math.PI / 180);
}

// 1 A current, 0.001 m² loop in 0.1 T field
console.log(`Motor torque (perpendicular): ${motorTorque(1, 0.001, 0.1, 90)} N·m`);

// Maglev: levitating force
function maglevForce(B_train, B_rail, area) {
  // Force ~ B² · A / (2μ_0)
  return B_train * B_rail * area / (2 * mu_0);
}

// Magnetic field at center of a current loop
function loopFieldCenter(I, R) {
  return mu_0 * I / (2 * R);
}

console.log(`5A loop, 5cm radius: B = ${(loopFieldCenter(5, 0.05) * 1e6).toFixed(0)} µT`);

// Compare gravitational vs magnetic force on suspended wire
function suspendedWireBalance(mass_per_length, g = 9.81) {
  // For wire to be levitated by upward F = ILB, need ILB = mg per length
  // F/L = m·g/L = mass_per_length · g
  return mass_per_length * g;
}

// Copper wire 1 mm² has m/L ≈ 8.96 g/m = 0.00896 kg/m
const F_per_L_required = suspendedWireBalance(0.00896);
console.log(`Need F/L = ${F_per_L_required.toFixed(2)} N/m to levitate copper`);

// In a 0.1 T field, current required:
console.log(`In 0.1 T field, I = ${(F_per_L_required / 0.1).toFixed(2)} A`);

Where this applies

  • Electric motors. Universal — every motor uses force on current-carrying wire in B field.
  • Generators. Reverse process — motion of wire in B field induces current (Faraday's law).
  • Loudspeakers and headphones. Audio signals → mechanical motion via wire-in-field forces.
  • Magnetic levitation. Trains (Shanghai Maglev, JR-Maglev), labs, levitating frogs.
  • Particle accelerators. Bend charged-particle beams.
  • MRI gradient coils. Generate spatial-encoding fields.
  • Mass spectrometers. Magnetic deflection identifies ions by mass.

Common mistakes

  • Wrong direction of force. Right-hand rule for cross product; for negative charges (electrons), reverse.
  • Using L as scalar. L is a vector along wire (in current direction). For complex shapes, integrate F = I·dL × B.
  • Forgetting parallel wires need same plane. The simple formula assumes infinite parallel wires; reality more complex for finite wires.
  • Confusing attractive and repulsive. Same-direction currents attract; opposite repel. Mnemonic: same direction means same-rotation B fields, which align between wires (= flux concentration → tension pulling them together).
  • Ignoring wire mass and thermal limits. High currents heat wires (I²R); maglev needs careful balance.
  • Treating force as everywhere. Net force on a closed current loop in UNIFORM B is zero (only torque). For motion need non-uniform field or external arrangement.

Frequently asked questions

Why does a wire in a magnetic field feel force?

Each electron carrying current is moving — and a moving charge in B field feels Lorentz force. Sum these forces over all electrons in the wire — total is F = I·L × B. The force on the wire collectively comes from all individual electrons being pushed sideways.

How do electric motors use this?

A current loop in a magnetic field experiences torque — opposite forces on opposite sides of the loop create rotation. Brushes flip current direction at right moments to maintain torque. AC motors don't need brushes — alternating current naturally provides reversing forces.

Why do parallel wires attract or repel?

Each wire creates a B field. Each wire is in the OTHER's B field, so feels force. For currents in the SAME direction — fields add at midpoint; force pushes them together. Currents in OPPOSITE directions — fields cancel at midpoint; pushes them apart. This was used to define the ampere (until 2019 SI redefinition).

How is the ampere defined?

Old definition (pre-2019): the ampere is the constant current that produces a force of 2 × 10⁻⁷ N per meter between two parallel wires 1 meter apart in vacuum. New 2019 definition: ampere defined via fixed elementary charge e = 1.602 × 10⁻¹⁹ C; ampere = elementary charges per second / e.

What's a railgun?

Two parallel rails carry current; armature (projectile) connects them. Current flowing through rails + armature creates a B field; force on the current-carrying armature accelerates it down the rails. Modern railguns: armature speeds 2-3 km/s. Power requirements are huge — military and research applications only.

How are loudspeakers driven?

Voice coil (wire wrapped around moving cone) in static magnetic field. Audio signal as current → force on coil — F = I·L × B. Coil/cone vibrates with audio waveform, pushing air, creating sound. Same for headphones.

What about MHD propulsion?

Magnetohydrodynamic — current in conductive fluid (seawater, plasma) in magnetic field — produces thrust. Has been demonstrated for ships ("Yamato 1") but inefficient compared to propellers. Used in some space-based plasma thrusters and proposed for fusion plasma research.