The Earth's magnetic field, which protects us from potentially dangerous solar radiation, is gradually losing its stability. No need to move underground or build space colonies just yet, though: the changes are taking place over millions of years.

You might assume that compasses will always point north, but in fact the magnetic poles have swapped places many times in the Earth's history. Earth scientists have long suspected that these flips are becoming more frequent, and that the magnetic field was less prone to pole reversals in the distant past.

Now the most detailed analysis of the geological evidence to date suggests that the field really is slowly destabilising. Whereas in the distant past it reversed direction every 5 million years, it now does so every 200,000 years.

Earth's magnetic field is powered by the heart of the planet. At its centre is a solid inner core surrounded by a fluid outer core, which is hotter at the bottom. Hot iron rises within the outer core, then cools and sinks. These convection currents, combined with the rotation of the Earth, are thought to generate a "geodynamo" that powers the magnetic field.

The last major reversal was 781,000 years ago

Because of changing temperatures and fluid flows, the strength of the magnetic field varies, and the positions of the north and south magnetic poles shift.

These shifts leave traces in rocks. When lava cools, metal oxide particles within the rock become frozen in the direction of the prevailing magnetic field. So scientists can work out the historic positions of the magnetic poles by examining and dating lava samples.

As a result we know there have been about 170 magnetic pole reversals during the last 100 million years, and that the last major reversal was 781,000 years ago.

So are these reversals becoming more or less common? In theory, it depends on what is happening to Earth's core.

Researchers believe the inner core is slowly growing, as the outer core cools and solidifies. That should mean more frequent flips. Simulations by Gary Glatzmaier of the University of California, Santa Cruz and his colleagues, suggest that a bigger inner core would be more of an obstruction to currents in the outer core, making for a more unstable magnetic field.

But it is hard to verify this, because in older rocks the evidence of magnetic field direction is less well preserved. So Toni Veikkolainen of the University of Helsinki in Finland, assembled a swathe of existing data from rock samples between 500 million and 3 billion years old.

First, Veikkolainen weeded out all the less reliable data. For example, he rejected all samples containing hematite, because it can form a long time after the rest of the rock, leading to muddled data. He also left out slow-cooling rocks like granite, and threw out samples that were known to have tilted, unless they could be accurately corrected based on other evidence.

Having whittled down around 300 data sets to 55, Veikkolainen estimated how frequently magnetic pole reversals occurred at different points in Earth's past.

The evidence points to a more stable field in the very far past and fewer reversals

He found that reversals happened about once every 3.7 million years between 500 million and 1.5 billion years ago. But in an earlier time, between 1.5 billion and 2.9 billion years ago, the magnetic field only flipped once every 5 million years.

That is much less often than in the last 150 million years, when the field has flipped every 600,000 years. In the last 10-20 million years it has sped up even more, to once every 200,000-250,000 years.

"The evidence points to a more stable field in the very far past and fewer reversals," says Veikkolainen.

"This looks to me to be the most thorough study that has been done so far, and it does reinforce many of the conclusions of earlier work, so I think it's pretty good evidence," says Robert Coe of the University of California, Santa Cruz.

Are we due for another flip? It's hard to say.

Data collected by the European Space Agency's Swarm satellite array reveals the Earth's magnetic field has recently been weakening at a rate of around five per cent per decade. The field does change all the time, but a rate of five per cent century is more normal, leading some to speculate a pole reversal may be imminent.

It is unclear precisely what would happen if the field weakens greatly or disappears for a time during a reversal. However, scientists believe power grids and communications systems are potentially at risk.