Bar Magnet, Compass, and Magnetic Field Lines Interactive

Have you ever seen someone sprinkle iron filings over a magnet to show the magnetic field around it? This interactive does almost the same thing!

The red and green rectangle (below) is like a bar magnet. The smaller, red and green diamond is like a compass needle. Drag the compass needle to explore the magnetic field around the bar magnet.

Red stands for the north pole of both the bar magnet and the compass needle. Green stands for the south pole of both the magnet and the needle.

This interactive uses Java software. If you can't see the interactive, you may not have Java on your computer.

Walter Fendt, April 20, 2001

The original version of this applet can be found at Walter Fendt's web site at Other Java applets by Walter Fendt related to physics topics are available at

Click on the magnetic needle and hold down the mouse button. You'll see a blue magnetic field line appear through the center of the compass needle. When you let go of the mouse button, the field line is "frozen" in place. You can draw more field lines by clicking on the compass needle and dragging it to another place.

Arrows on the magnetic field line show the direction of the field. Magnetic field lines "flow" from the north pole of a magnet to its south pole. That's the direction that the north pole of a compass needle points.

If you want to start over, click the "Clear field lines" button. That will erase all of the field lines you have drawn so far.

If you click the "Turn magnet" button the magnet will flip over. It will turn so its north pole is on the right and its south pole is on the left.

Interactive link Interactive animation: Bar Magnet & Compass (using Flash software)

Interactive link Interactive animation: Earth's Magnetic Field

Interactive link Earth's North Magnetic Pole interactive

Activity link Activity: Build a Magnetometer and use it to detect magnetic fields!

Last modified February 20, 2008 by Randy Russell.

You might also be interested in:

Cool It! Game

Check out our online store - minerals, fossils, books, activities, jewelry, and household items!...more

The Magnetic Field

The force of magnetism causes material to point along the direction the magnetic force points. As shown in the diagram to the left, the force of magnetism is illustrated by lines, which represent the force....more

Planetary Magnets

The Earth is a good example of a planetary dipole, where the lines of force point in a direction out of the South (magnetic) Pole and into the North (magnetic) Pole. Planets can also show evidence of quadrupoles...more

Detecting Planetary Magnetism

A magnetometer is an instrument for measuring magnetic fields. Many spacecraft carry magnetometers to measure the magnetic fields around planets. When a spacecraft makes those measurements, what do the...more

Electricity and Magnetism

Electricity and magnetism are two very important topics in the science of physics. We use electricity to power computers and to make motors go. Magnetism makes a compass point North and keeps notes stuck...more

Electromagnetic Radiation

Electromagnetic radiation is the result of oscillating electric and magnetic fields. The wave of energy generated by such vibrations moves through space at the speed of light. And well it should... for...more

Radio Waves

Radio waves are a type of electromagnetic radiation. A radio wave has a much longer wavelength than does visible light. We use radio waves extensively for communications. Radio waves have wavelengths as...more


Light is very strange. Sometimes it is best to think of light as a series of waves. At other times, it is useful to think of light as a swarm of particles. When we think of light as particles, we call...more

Windows to the Universe, a project of the National Earth Science Teachers Association, is sponsored in part is sponsored in part through grants from federal agencies (NASA and NOAA), and partnerships with affiliated organizations, including the American Geophysical Union, the Howard Hughes Medical Institute, the Earth System Information Partnership, the American Meteorological Society, the National Center for Science Education, and TERC. The American Geophysical Union and the American Geosciences Institute are Windows to the Universe Founding Partners. NESTA welcomes new Institutional Affiliates in support of our ongoing programs, as well as collaborations on new projects. Contact NESTA for more information. NASA ESIP NCSE HHMI AGU AGI AMS NOAA