# Magnets and Magnetic Fields Simulation

> A free magnet simulation for class: drag bar and horseshoe magnets, see field lines, iron filings and a compass, build an electromagnet, explore Earth's field.

Source: https://olyclass.com/simulations/magnets-and-magnetic-fields/ · Updated 2026-11-03

This simulation puts magnets on a table in front of the whole class. Drag bar magnets and a horseshoe magnet around, turn them, and watch the invisible field appear as field lines with arrows, a sprinkle of iron filings or a grid of tiny compass needles. A big compass swings to point along the field wherever you put it. Bring two ends together and the magnets tell you what happens: opposite poles attract and snap together, like poles push each other away. Two more scenes build an electromagnet from a coil, a nail and a battery, and show the Earth as a giant magnet.

## How to use it

- **Move things:** drag any magnet or the compass with a finger or the mouse. Several students can drag at the same time on a touch screen.
- **Turn a magnet:** tap it to choose it, then drag the round yellow handle beside it. Flip swaps its ends, Turn 45° rotates it a step.
- **Add magnets:** Bar magnet and Horseshoe add up to four magnets. Remove takes the chosen one away.
- **Views:** Field lines, Iron filings and Compasses show the same field three ways; Forces draws the push or pull on each magnet with its size in newtons.
- **Snap and push:** let go of a magnet with one end close to another magnet's end. Opposite poles snap together; like poles slide apart.
- **Electromagnet:** switch the current on and off, set the number of turns and the current, and reverse the current to swap the poles. Watch the paper clips.
- **Earth:** drag the compass around the planet and see that its N end always points north.
- **On a projector:** press full screen; text and buttons grow. Keys: arrows move the chosen magnet, Q and E turn it, F flips it (or reverses the current), Space switches the electromagnet.

## Poles and forces

Every magnet has two poles, a north pole (N, coral here) and a south pole (S, blue). You can't get one without the other: cut a bar magnet in half and each half has its own N and S.

- **Opposite poles attract:** N pulls S.
- **Like poles repel:** N pushes N away, and S pushes S.
- The force gets weaker quickly with distance. Move a magnet twice as far away and the Forces arrows shrink to well under half.

The N pole got its name because a freely turning magnet points it north. That is the job of a compass needle: it is a small magnet whose N end is painted.

## Magnetic field and field lines

A magnet changes the space around it: that space holds a **magnetic field**. You can't see it, but you can see what it does to iron filings and to a compass.

**Field lines** are a map of the field:

- they leave the N pole and go round to the S pole, outside the magnet;
- the arrow on a line is the way a compass needle's N end points there;
- where lines crowd together, near the poles, the field is strong; where they spread out, it is weak;
- field lines never cross.

Press Iron filings to see the same pattern the way it appears on paper over a real magnet, then Compasses: every tiny needle lines up with the lines. Put two magnets N to N and you'll find a spot between them where the field cancels and the compasses go faint: a neutral point.

## How the model works

Each pole acts like a small "magnetic charge" q, positive for N and negative for S. The field from one pole at a distance r is

B = (μ0 / 4π) · q / r²

pointing away from an N pole and towards an S pole. The field from several magnets is the sum of the fields from all their poles, added as arrows. A pole in the field of another magnet feels a force F = q·B, and the Forces arrow adds those up for each magnet. The magnets here give about 10 mT a centimetre from a pole; the compass shows the field where it stands.

## The electromagnet

A coil of wire carrying a current makes a magnetic field just like a bar magnet. Inside a long coil without a core:

B = μ0 · N · I / ℓ

where N is the number of turns, I the current in amperes and ℓ the coil's length. The coil here is 6 cm long, so 100 turns with 1 A give 4π × 10⁻⁷ × 100 × 1 / 0.06 = 2.09 mT. Only N × I counts: 50 turns with 2 A give the same field as 100 turns with 1 A. An iron nail inside makes the field much stronger, about 50 times in this model, which is why the nail picks up paper clips (one more clip for every 45 ampere-turns, up to six).

**Which end is N?** Use the **right-hand rule**: curl the fingers of your right hand the way the current flows round the turns, and your thumb points to the N pole. Press Reverse the current and the poles swap; the compass turns round to show it. Switch off and the field disappears, so the clips fall.

## Earth's magnetic field

The Earth behaves like a huge bar magnet inside it, tilted about 10° from the axis it spins on. The magnet's **S pole lies near the geographic North Pole**, which is why the N end of a compass points north: opposite poles attract. At the surface the field is weak, about 25 to 65 µT (millionths of a tesla), about a hundred times weaker than a fridge magnet up close, but enough to turn a compass needle.

## Try this

1. Put the compass near each end of a bar magnet. Which end does the red tip point to, and why?
2. Turn on Compasses and trace one field line with your finger from N to S.
3. Line up two magnets N to N, then N to S. Compare the field lines between them. Where is the neutral point?
4. Electromagnet: find two different settings that pick up exactly three paper clips. What do they have in common?
5. Reverse the current with the compass beside the nail. Use the right-hand rule to predict which way it will turn first.
6. Earth: walk the compass right round the planet. Does it ever point south?

## Teaching ideas

The simulation fits units on magnetism and electromagnetism: NGSS 3-PS2-3, 3-PS2-4, MS-PS2-3 and MS-PS2-5, KS2 and KS3 magnets, GCSE magnetism and electromagnetism.

1. **Predict (5 minutes):** show two magnets far apart and ask: "If I bring these two ends together, will they attract or repel?" Vote, then drag them together.
2. **Map the field (10 minutes):** with Iron filings on, students draw the pattern in their books, then switch to Field lines and add the arrows.
3. **Compass hunt (5 minutes):** a student moves the compass on the touch screen while the class calls out where it will point next.
4. **Electromagnet investigation (15 minutes):** groups change one variable at a time (turns, current) and record the clips picked up in a table. Plot clips against N × I.
5. **Review (10 minutes):** make a review game with the button above and play it as a class, in teams, with your phone as the remote.

## Questions teachers ask

### Why do field lines go from N to S?

That is how the direction of a magnetic field is defined: the direction the N end of a compass points. Outside a magnet the N end of a compass points away from the magnet's N pole and towards its S pole, so the lines run from N to S. Inside the magnet they carry on from S back to N, making closed loops.

### Is the field in the simulation real?

It is computed from a standard model in which each pole acts like a point "magnetic charge", added up over every pole. The shapes of the field lines, the neutral points and the way the force falls off with distance match real bar magnets well; the numbers are typical values for a school magnet, not one particular magnet.

### Why does the compass wobble before it settles?

A real compass needle has inertia, so it swings past the field direction and back a few times while friction in the pivot slows it down. The simulation models that with a damped swing. With reduced motion turned on in your device settings, the needle jumps straight to the field direction.

### Why does an iron nail make the electromagnet stronger?

Iron is made of tiny regions that each act like a small magnet. The coil's field lines them up, so the nail becomes a magnet itself and adds its field to the coil's. A long, thin core like a nail can make the field tens to hundreds of times stronger; the simulation uses ×50.

### If the N pole of a compass points north, is the Earth's North Pole a north pole?

No. Opposite poles attract, so the magnetic pole near the geographic North Pole must be a magnetic S pole. It is still often called the "north magnetic pole" because of where it is, which is why the simulation labels both.

### Do I need to install anything or sign up?

No. It runs in any modern browser, on a computer, an interactive display, a tablet or a phone, and it's free.

[Make a review game](https://olyclass.com/create?subject=science&grade=7&topic=Magnets%20and%20magnetic%20fields:%20poles,%20field%20lines,%20compass,%20electromagnets,%20Earth's%20magnetic%20field)

## Credits

Model and drawings: Oly. Each pole is treated as a magnetic charge: B = μ0/4π · q/r², added up over every pole, and a pole in a field feels F = q·B; field lines are traced along B. Electromagnet: B = μ0·N·I/ℓ inside a long coil, μ0 ≈ 4π × 10⁻⁷ T·m/A ([NIST](https://physics.nist.gov/cgi-bin/cuu/Value?mu0)). Earth's field: a dipole tilted about 10° from the spin axis, about 25 to 65 µT at the surface ([NOAA NCEI, World Magnetic Model](https://www.ncei.noaa.gov/products/world-magnetic-model)). The iron nail's ×50 and the paper clip rule are round values chosen for this model.
