PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabs
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry

More from Electricity & Magnetism

Other simulators in this category — or see all 56.

View category →
NewSchool

Biot–Savart Law

Infinite wire B ∝ 1/r; ring via segment sum; heatmap + probe.

Launch Simulator
NewSchool

Electric Dipole Field (2D)

±q on axis: V heatmap, equipotentials, E field lines; formulas.

Launch Simulator
NewSchool

Ideal Op-Amp (feedback)

Inverting, non-inverting, buffer; sine or DC; optional rail clipping.

Launch Simulator
NewSchool

Van de Graaff Generator

Belt charges a dome; V = Q/C; stylized spark to ground when V_break is exceeded.

Launch Simulator
NewSchool

Kirchhoff's Laws (KCL & KVL)

3-node DC: junction divider + optional R∥V; hints, KCL/KVL, solved currents.

Launch Simulator
NewSchool

Plane EM Wave (vacuum)

E ⊥ B ⊥ k: sin(kz−ωt) fields, Poynting along z; ω = ck (c = 1).

Launch Simulator
PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Electricity & Magnetism/Bar Magnet & Iron Filings

Bar Magnet & Iron Filings

A bar magnet is approximated by two opposite magnetic poles ±qₘ placed at the ends of the bar, so the magnetic field at any point is the sum of two inverse-square contributions B = (μ₀/4π) Σ qₘ r̂/r². A few thousand short line segments — virtual iron filings — are scattered on the page and rotated at every frame to align with the local B direction; their brightness scales with |B|, so dense field regions near the poles glow and the looping closed lines from N to S emerge automatically. The magnet itself can be dragged and rotated to see how the field pattern follows.

Who it's for: Intro magnetism and field-line visualisation; pairs nicely with the magnetic-field and Hall-effect simulators.

Key terms

  • bar magnet
  • magnetic field lines
  • magnetic poles
  • iron filings
  • field visualisation
  • dipole field

Bar magnet

180 px
60000
0°

Filings

34

A bar magnet is approximated as two opposite magnetic charges (+q at the N tip, −q at the S tip). The local field B = Σ q (r − r_p) / |r − r_p|³ is computed at hundreds of jittered cell centres; each iron filing is drawn as a short rod aligned with B and its length/intensity scales with |B|. Drag the magnet body to translate it through the field, or hold Shift while dragging to rotate.

Shortcuts

  • •Drag the magnet body to move
  • •Shift + drag to rotate
  • •Use the angle slider for precise rotation

Measured values

Length180px
Angle0°
Pole strength60000

How it works

Iron filings on a card make the magnetic field of a bar magnet visible. Each filing is a tiny dipole that lines up with the local B; together they trace the field lines from N to S. Drag the magnet around — the lines reorganise in real time.

Key equations

B(r) = Σ_p (q_p / |r − r_p|³)·(r − r_p) (two-pole model)
A filing aligns with the local B direction (no torque only when parallel).

Frequently asked questions

Are real iron filings actually monopoles?
No. Each filing is itself a tiny induced magnet: it polarises along the local field and then rotates so its own N–S axis lines up with B. The macroscopic effect — segments tracing field-line directions — is what we render here.
Is the two-pole model accurate far from the magnet?
Far away the field of any magnet looks like a magnetic dipole, which our two opposite poles reproduce exactly. Up close the model is a useful cartoon but misses the volumetric magnetisation distribution inside a real bar.
Why are the field lines closed loops?
∇·B = 0 means magnetic field lines never start or end in space — they always close on themselves, leaving the north pole, looping through the surrounding region, and re-entering at the south pole.