The Earth is surrounded by a magnetic field, which originates inside its molten core, and which for centuries has helped travellers to navigate safely across uncharted regions. The magnetic field protects life on the Earth by acting as a shield against harmful radiation from space, especially from the Sun. ‘The Earth’s magnetic field’ explains that the magnetic field at the Earth’s surface is dominantly that of an inclined dipole. The Sun’s deforming effect on the magnetic field outside the Earth is described, as are the magnetic fields of other planets. The magnetism of rocks forms the basis of palaeomagnetism, which explains how plate tectonics displaced the continents and produced oceanic magnetic anomalies whenever the geomagnetic field reversed polarity.