Magnetic Field & Electromagnetism Visualizer
Calculate magnetic fields, magnetic force, solenoid fields, and wire interactions with right-hand-rule visuals, vector diagrams, and step-by-step physics explanations.
Background
Magnetic fields are invisible, directional, and often hard to picture. This visualizer helps students connect formulas to field direction, current direction, charge motion, and right-hand-rule reasoning.
How to use this visualizer
- Choose straight wire, magnetic force, solenoid, or parallel wires.
- Enter the current, distance, charge, speed, field, or coil values required by that mode.
- Click Calculate Magnetic Field to see the result, field diagram, and steps.
- Use quick examples to explore common electromagnetism homework setups.
- Read the right-hand-rule card to understand the direction, not just the number.
How this calculator works
- For a long straight wire, it uses the magnetic field formula for a current-carrying wire.
- For a moving charge, it calculates magnetic force from charge, speed, magnetic field, and angle.
- For a solenoid, it estimates the field from turns per meter, current, and relative permeability.
- For parallel wires, it calculates force per length and whether the wires attract or repel.
- The visual diagrams emphasize direction, field geometry, and right-hand-rule reasoning.
Formula & Equations Used
Magnetic field around a long wire: B = μ₀I / 2πr
Magnetic force on a moving charge: F = |q|vB sin θ
Solenoid field: B = μ₀μᵣnI
Turns per length: n = N / L
Force per length between parallel wires: F / L = μ₀I₁I₂ / 2πd
Vacuum permeability: μ₀ = 4π × 10⁻⁷ T·m/A
Example Problems & Step-by-Step Solutions
Example 1: Magnetic field near a straight wire
A long straight wire carries 10 A. Find the magnetic field 5 cm from the wire.
B = μ₀I / 2πr
B = (4π × 10⁻⁷)(10) / (2π)(0.05)
B = 4.0 × 10⁻⁵ T = 40 μT
Using the right-hand rule, the magnetic field circles around the wire.
Example 2: Magnetic force on a moving charge
A proton moves at 2.0 × 10⁶ m/s perpendicular to a 0.20 T magnetic field.
F = |q|vB sin θ
F = (1.60 × 10⁻¹⁹)(2.0 × 10⁶)(0.20)(sin 90°)
F = 6.4 × 10⁻¹⁴ N
Because the charge is positive, the force points in the right-hand-rule direction.
Example 3: Magnetic field inside a solenoid
A solenoid has 500 turns, length 0.25 m, current 2 A, and air core μᵣ = 1.
n = N / L = 500 / 0.25 = 2000 turns/m
B = μ₀μᵣnI
B = (4π × 10⁻⁷)(1)(2000)(2)
B ≈ 5.03 × 10⁻³ T = 5.03 mT
Example 4: Force between parallel wires
Two parallel wires carry 5 A and 8 A in the same direction, separated by 0.10 m.
F / L = μ₀I₁I₂ / 2πd
F / L = (4π × 10⁻⁷)(5)(8) / (2π)(0.10)
F / L = 8.0 × 10⁻⁵ N/m
Because the currents point in the same direction, the wires attract.
Magnetism concepts students often mix up
- Magnetic fields are vectors: direction matters as much as magnitude.
- Right-hand rule depends on charge sign: reverse the direction for a negative charge.
- No perpendicular motion means less force: only the velocity component perpendicular to B contributes.
- Same-direction currents attract: opposite-direction currents repel.
- Wire fields form circles: field lines wrap around the current direction.
FAQs
What is a magnetic field?
A magnetic field is a vector field that describes magnetic influence on moving charges, currents, and magnetic materials.
How do you find the magnetic field around a wire?
For a long straight wire, use B = μ₀I / 2πr, where I is current and r is distance from the wire.
When is magnetic force zero?
Magnetic force is zero when the charge is not moving or when velocity is parallel to the magnetic field.
Do parallel currents attract or repel?
Parallel wires with currents in the same direction attract. Currents in opposite directions repel.