No matter how much you slacked through elementary science class, you probably remember at least a bit about the Earth’s great cross-section. There’s the crust (that’s our turf), and directly below that the mantle, just 5 to 70 kilometers below our feet, depending. This is the thickest portion of the Earth, and though it’s technically not molten, it’s hot enough to make its silicate rocks malleable, causing it to flow over the course of millions of years. Beneath this is the planet’s molten outer core, a sea of mostly iron and nickel that has remained liquid for billions of years. And finally, there is the inner core, a solid mass of the heaviest elements on Earth. The inner core is speculated to contain large amounts of gold and platinum, among other things — if only we could get to it.

So, why isn’t the whole thing solid? After so many billions of years of waiting, you’d think the world would have cooled off by now — and yet the mantle remains partially plastic, the outer core totally molten, and even the inner core is incredibly hot, if too stubborn to liquify.

The Earth has managed to keep even heavy metals molten for billions of years.

The most obvious part of the explanation is simply the ground beneath your feet. As the Earth began to cool in its earliest stages of development, the crust formed on the exterior and acted as a mild insulator for the interior. With a solid layer on top, the circulation of material below stopped exposing portions of that material to the atmosphere, letting it hold on to its heat much more effectively.

Beyond that, it’s necessary to point out the fact that, in reality, a few billion years really isn’t all that long. The majority of heat in the Earth is, quite simply, left over from its early stages, and has yet to escape. The Earth is constantly cooling, as evidenced by the fact that the planet’s current two-phase core, solid interior surrounded by liquid exterior, was originally entirely liquid. As iron solidifies it actually becomes more dense (unlike water), meaning two things: the cooler portions of molten iron tend to sink and eventually aggregate into the solid inner core, and that as the whole core cools it actually shrinks.

Radioactive decay of elements like this Potassium 40 atom is a major source of heat in the Earth.

This core shrinking is partially responsible for some types of earthquakes, at least indirectly. One reason it takes so long to form a solid interior (the solid core is still much smaller than the liquid) is that the deeper you go, the greater the pressure. At the Earth’s center, pressures reach 360,000,000,000 Pascals, or 3,552,923 times the pressure at sea level. As you might imagine, this makes it difficult to solidify; cooler iron sinks deeper, where higher pressure heats them up again. Eventually the process will complete, but not for a long, long time. The estimated rate of cooling is 100 degrees Celsius per billion years.

The biggest source of heat below the Earth’s crust, however, is less intuitive: radioactive decay. The elements Potassium, Uranium, and Thorium all exist in high amounts as unstable isotopes with long half-lives. The energy released by the slow decay of these huge metal deposits is enough to keep heavy metal molten. Even the comparatively stable surface minerals do this — a block of granite will emit a small but measurable amount of heat thanks to these very same forces.

Ultimately, the Earth’s molten interior is the product of many factors. Just be happy it is the way it is, since a cold planet is also a death planet. Don’t worry though; long before the Earth cools and dies, our Sun will have swallowed it whole.