Earth’s magnetic field is thought to be generated largely by an ocean of superheated, swirling liquid iron that makes up Earth’s outer core 3000 km under our feet. Acting like the spinning conductor in a bicycle dynamo, it generates electric currents and thus the continuously changing electromagnetic field.