Magnets have been used in compasses for as long as compasses have existed, as magnetic compasses were the earliest navigational tools. Lodestones, which are naturally magnetised volcanic rocks, were the first used in compasses, but today people can magnetise needles to act as compass magnets. The Earth has magnetic qualities that attract the magnets in compasses, but the magnets will not find true north by magnetism alone.
The magnetic compass was probably invented in China between 221 and 206 B.C., though the ancient Greeks also knew about magnetism, according to the National Maritime Museum in London. The Chinese employed lodestones, which are made of iron oxide, to align compasses on a north-south line. Initially, fortune tellers used these compasses in fortune telling boards, but later they developed into navigational compasses. Magnetised needles, rubbed with lodestones to produce the magnetic quality, took the place of lodestones in the 8th century A.D., and by the Middle Ages, European ships commonly used magnetic compasses for navigating the seas.
A magnetic field surrounds the Earth, which thus acts as a huge magnet. This magnetic field attracts anything on Earth that is magnetised, such as a lodestone or magnetised needle, which will align with Earth's magnetic field along the north-south line.
People make magnets for compasses in several ways. Since ancient times, people have used lodestones as natural compass magnets. Another option is magnetising a needle by holding it next to a magnet, then setting the needle on a piece of wood and floating the wood and needle in a bowl of water, such as sailors did hundreds of years ago. Placing a magnetised needle on a swivel inside a flat, round container is a common method for modern magnetic compasses.
The magnetic field does not run directly in line with Earth's rotational axis, but is off by about 11 degrees. For this reason, magnetic compasses do not point to Earth's north with complete accuracy, but instead point to Earth's magnetic north. This is called magnetic variation or magnetic declination, which is the difference between magnetic north and true north. The magnetic field also varies according to the location of the compass on Earth, and magnetic north shifts gradually over time, as the National Geophysical Data Center explains.
The Earth's magnetism is weak, which means if other magnets are near the compass magnet, these other magnets will overpower the Earth in attracting the compass needle. For instance, iron ships affect the accuracy of magnetic compasses. Sir G.B. Airy, a 19th-century astronomer, developed a system of placing demagnetised iron around the compass to neutralise the ship's magnetism and its effect on the compass. Today, modern compasses like the gyrocompass find true north with greater accuracy than magnetic compasses.