Skip to main content

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.

Analyze magnetic fields

Choose a mode

Start with a current-carrying wire, magnetic force, solenoid field, or parallel-wire interaction.

Straight current-carrying wire

Find the magnetic field strength at a distance from a long straight wire.

Formula

B = μ₀I / 2πr

Right-hand rule

Thumb follows current; fingers curl with B.

Used only when solving for I or r.

Magnetic force on a moving charge

Calculate force magnitude and use the right-hand rule to determine direction.

Formula

F = |q|vB sin θ

Direction

Use v × B; reverse for negative charge.

Used only when solving for q, v, B, or θ.

Solenoid / coil magnetic field

Estimate the field inside a long solenoid using turns per length and current.

Formula

B = μ₀μᵣ(N/L)I

Field idea

More turns per meter or current makes B stronger.

Used only when solving for N, L, I, or μr.

Use 1 for air/vacuum. Larger values model magnetic cores.

Force between parallel current-carrying wires

Compare currents and direction to see whether wires attract or repel.

Supported formats

10 A 5 cm 2e6 m/s 1.6e-19 C fractions like 1/2 mT and μT
  • Use positive magnitudes; choose direction from the menus.
  • Use 90° when velocity is perpendicular to the magnetic field.
  • Right-hand rule directions reverse for negative charges.
  • Magnetic-field arrows and loops are scaled for readability.

Right-hand-rule cheat sheet

Wire field

Thumb = current. Curled fingers = magnetic field loops.

Moving charge

Fingers = velocity. Curl toward B. Thumb = force for positive charge.

Negative charge

Find the positive-charge direction first, then reverse it.

Options

Result

Copied!

No result yet. Choose a mode, enter values, then click Calculate Magnetic Field.

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.

Wavelength and Frequency
9. Quantum Mechanics
3 problems
Topic
Jules
The Energy of Light
9. Quantum Mechanics
7 problems
Topic
Jules
Electromagnetic Spectrum
9. Quantum Mechanics
5 problems
Topic
Jules
Coulomb's Law
11. Bonding & Molecular Structure
5 problems
Topic
Jules
9. Quantum Mechanics - Part 1 of 3
6 topics 12 problems
Chapter
Jules
9. Quantum Mechanics - Part 2 of 3
6 topics 11 problems
Chapter
Jules
9. Quantum Mechanics - Part 3 of 3
6 topics 11 problems
Chapter
Jules
11. Bonding & Molecular Structure - Part 1 of 4
4 topics 12 problems
Chapter
Jules
11. Bonding & Molecular Structure - Part 2 of 4
4 topics 11 problems
Chapter
Jules
11. Bonding & Molecular Structure - Part 3 of 4
5 topics 11 problems
Chapter
Jules
11. Bonding & Molecular Structure - Part 4 of 4
4 topics 11 problems
Chapter
Jules
Vectors, Scalars, & Displacement
2. 1D Motion / Kinematics
6 problems
Topic
Patrick
Introduction to Vectors
3. Vectors
2 problems
Topic
Patrick
Vector Composition & Decomposition
3. Vectors
7 problems
Topic
Patrick
Adding Vectors by Components
3. Vectors
7 problems
Topic
Patrick
Intro to Cross Product (Vector Product)
3. Vectors
4 problems
Topic
Patrick
Calculating Cross Product Using Components
3. Vectors
1 problem
Topic
Patrick
Newton's First & Second Laws
6. Intro to Forces (Dynamics)
7 problems
Topic
Patrick
Types Of Forces & Free Body Diagrams
6. Intro to Forces (Dynamics)
7 problems
Topic
Patrick
Forces in 2D
6. Intro to Forces (Dynamics)
3 problems
Topic
Patrick
Force & Potential Energy
10. Conservation of Energy
7 problems
Topic
Patrick
2. 1D Motion / Kinematics - Part 1 of 2
7 topics 14 problems
Chapter
Patrick
2. 1D Motion / Kinematics - Part 2 of 2
5 topics 13 problems
Chapter
Patrick
3. Vectors - Part 1 of 2
4 topics 9 problems
Chapter
Patrick
3. Vectors - Part 2 of 2
4 topics 9 problems
Chapter
Patrick
6. Intro to Forces (Dynamics) - Part 1 of 2
4 topics 12 problems
Chapter
Patrick
6. Intro to Forces (Dynamics) - Part 2 of 2
5 topics 12 problems
Chapter
Patrick
10. Conservation of Energy
7 topics 15 problems
Chapter
Patrick
Electromagnetic Spectrum
9. Photosynthesis
2 problems
Topic
Brendan
9. Photosynthesis - Part 1 of 2
6 topics 8 problems
Chapter
Jason
9. Photosynthesis - Part 2 of 2
5 topics 8 problems
Chapter
Jason
Electromagnetic Spectrum
13. Photosynthesis
1 problem
Topic
Nicole
13. Photosynthesis
9 topics 12 problems
Chapter
Brendan
All Calculators & ConvertersAll calculators