Bar Magnet, Compass, and Magnetic Field Lines Interactive

The red and green rectangle in this interactive represents a bar magnet. The smaller, red and green diamond represents a compass needle. Drag the compass needle around to explore the magnetic field surrounding the bar magnet.

Red represents the north magnetic pole of both the bar magnet and the compass needle. Green represents the south magnetic pole of both the magnet and the needle.

This interactive makes use of Java software. If you cannot 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

When you click on the magnetic needle and hold down the mouse button, a magnetic field line through the center of the compass needle is drawn in blue. When you release the mouse button, the field line is "frozen" in place. You can draw additional field lines by clicking on the compass needle and dragging it to a new position.

Arrows along the magnetic field line show the direction of the field. By convention, magnetic field lines "flow" from the north pole of a magnet to its south pole, in the direction that the north pole of the compass needle points.

Click the "Clear field lines" button to erase all of the field lines you have drawn so far and start over with a "clean slate".

Click the "Turn magnet" button to flip the bar magnet so the directions of its magnetic poles are reversed.

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:

Traveling Nitrogen Classroom Activity Kit

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. This property implies that the force of magnetism has a direction. As shown in the diagram to the left, the...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 they orbit or fly by. When a spacecraft takes such measurements,...more

Electricity and Magnetism

Electricity and magnetism are two closely related and very important topics within the science of physics. We use electricity to power computers and to make motors go. Magnetism makes a compass point North...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