Skip to content
0 of 6 missions completed.

🧲 Magnetic Fields Lab

🧲 Magnetic Fields

Magnetic Dipoles

Every magnet has a North and South pole. Field lines exit from N and enter at S. Like poles repel, opposite poles attract. The field strength decreases with distance squared (1/r²). Drag magnets to see how the field changes in real-time! Double-click a magnet to rotate it 45°.

Magnetic Field Simulation Online — Free Interactive Visualizer

This magnetic field simulator renders the field from one or more draggable bar magnets using a dipole approximation. Choose from three visualization modes: field lines traced from N poles, a grid of compass needles that also shows |B| and angle at the cursor, or a vector field with arrow length proportional to field strength. Presets cover bar magnet, horseshoe magnet, attracting pair, repelling pair, and crossed magnets. Add additional magnets to explore superposition of fields.

What you can do in this simulation

  • Switch between Field Lines, Compass Needles, and Vector Field views
  • Drag magnets anywhere on the canvas to reposition them
  • Add multiple magnets or remove all with Reset
  • Adjust field line density slider
  • Hover in Compass Needles mode to read |B| magnitude and field angle

Concepts covered

magnetic field simulation · magnetic field simulation online · magnetic dipole · field lines · bar magnet visualization · Biot-Savart law

How to read a magnetic field

A magnetic field is a vector field — at every point in space it has both a strength and a direction. This simulator gives you three ways to see it. Field lines trace the path a tiny north pole would follow, always leaving the magnet's north pole and curving back into its south. Compass needles show the field's direction at a grid of points, exactly as a real compass would swing. The vector view draws arrows whose length grows with field strength, so you can see the field weaken with distance.

Switch between the three modes on the same magnet arrangement and you will notice they all describe the identical field — field lines bunch together where the vector arrows are longest and the compass needles turn most sharply, which is where the field is strongest.

Experiments to try

Begin with a single bar magnet and watch the classic dipole pattern: dense field lines near the poles fanning out into wide loops. Then add a second magnet and drag it close. Line up opposite poles (N facing S) and the field lines link the two magnets into smooth bridges — the signature of attraction. Flip one magnet so like poles face each other and the lines refuse to join, buckling away from the gap to show repulsion.

Try the horseshoe preset to see why that shape concentrates a strong, nearly uniform field between its arms — the same trick used in electric motors and loudspeakers. Hover in compass-needle mode to read the field magnitude and angle at the cursor and confirm it drops off quickly as you move away.

The physics behind the picture

Each magnet here is modelled as a magnetic dipole, and the field from several magnets is found by vector superposition — you simply add the field contributions from every magnet at each point. That is why bringing a second magnet in reshapes the whole pattern rather than just its own neighbourhood.

The field of a dipole falls off with the cube of distance, much faster than gravity or a single electric charge, which is why the arrows shrink so rapidly as you pull away from a magnet. The Biot–Savart law is the underlying rule that links moving charges and currents to the magnetic fields they create.

Where magnetic fields show up

The Earth itself is a giant bar magnet — its dipole field is what turns a compass needle and shields the planet from the solar wind. The same field patterns you build here explain how electric motors spin, how speakers turn current into sound, how MRI scanners image the body, and how maglev trains float.

For students, this visualiser makes the invisible visible: the field-line and compass pictures used throughout physics textbooks and exams (including CBSE, JEE, and NEET) are exactly what you can generate and manipulate here.

Related simulations

Browse all Physics simulations →

Related reading

Free to use in your browser — no signup required. Found a bug or have an idea to make it better? Tell us.

Finished experimenting?

Save one completion to this browser's signed guest ledger, or directly to your account when signed in.