Of all the planets, dwarf planets, moons, asteroids, and more in the Solar System, only one object can be the densest. You might think, based on the fact that gravitation is a runaway process that just builds upon itself to a greater and greater degree, that the most massive objects of all things like Jupiter or even the Sun would be densest but they are less than a quarter the density of Earth.
You might go a different route and think that the worlds that are made out of the greatest proportion of the heaviest elements would be the densest too. If that were the case, however, Mercury would be the densest world and it isn't. Instead of all the large objects that are known in the Solar System, Earth is the densest of all. Here is the surprising science of why.
Density is one of the simplest non-fundamental properties of matter you can imagine. Every object that exists from the microscopic to the astronomical has a certain amount of energy at rest intrinsic to it what we commonly call mass. These objects also take up a given amount of space in three dimensions: what we know as volume. Density is just the ratio of these two properties the mass of an object divided by its volume.
Our Solar System itself has formed some 4.5 billion years ago the way all solar systems are formed from a cloud of gas in a star-forming region that contracted and collapsed under its own gravity. Recently, thanks to observatories such as ALMA (the Atacama Large Millimetre/submillimetre Array), researchers have been able to directly image and analyze the protoplanetary disks that form around these newborn stars for the first time.
Some of the features of an image like this are striking. You can see a large extended disk around a newly forming star the material that will give rise to planets, moons, asteroids, and outer (Kuiper-like) belts, etc. You can see gaps in the disk locations where massive objects like planets are already forming. You can see a color-coded temperature gradient, where the inner regions are hotter and the outer regions are colder.
But what you can't visually see from an image such as this is the presence and abundance of the different types of materials. While complex molecules and even organic compounds are found throughout systems such as this, there are three important effects that all work together to determine which elements wind up in which locations in the Solar System that results.
The first factor is gravitation, which is always an attractive force. In a disk of matter made up of tiny particles, the ones that are closer to the interior of the disk will revolve around the center of the solar system at slightly higher speeds than the ones slightly farther out causing collisions between particles as they pass one another in this orbital dance.
Where slightly larger particles have already formed or where smaller particles stick together to form larger ones, the gravitational force becomes slightly larger as having an overdense region preferentially attracts more and more of the surrounding mass. Over thousands to millions to tens of millions of years, this will lead to the runaway formation of planets at whichever locations happened to accrue the most mass in one location the fastest.
The second factor is the temperature of the central star as it evolves from its pre-birth as molecular clouds through its phase as a proto-star to its long life as a full-fledged star. In the interior region closest to the star, only the heaviest elements of all can survive as everything else is too light that it's blasted apart by the intense heat and radiation. The most-interior planets will be made of metals alone.
Outside of that, there is a frost line (with no volatile ices interior to that but with volatile ices beyond that) where our terrestrial planets all formed inside the frost line. While these lines are interesting, it also teaches us that there's a gradient of material that forms in the solar system. The heaviest elements are found in the highest proportion closest to the central star, while the heavier elements are less abundant farther away.
And the third and final element is that there is an intricate gravitational dance that takes place over time. Planets migrate. Stars heat up and ices get stripped away where they were allowed once before. Planets that may have orbited our star in earlier stages can get ejected, shot into the Sun, or triggered into colliding with and/or merging with other worlds.
And if you get too close to the star anchoring your solar system, the outer layers of the star's atmosphere can provide enough friction to cause your orbit to destabilize, spiraling into the central star itself. Looking at our Solar System today, 4.5 billion years after the whole thing formed, we can conclude an awful lot of things about what things must have been like in the early stages. We can put together a general picture of what occurred to create things as they are today.
But all we have left are the survivors. What we see follows a general pattern that's very consistent with the idea that our eight planets formed in roughly the order they're in today. Mercury is the innermost world followed by Venus, Earth, Mars, the asteroid belt, then the four gas giants each with their own lunar system, the Kuiper belt, and at last the Oort cloud.
If everything were based purely on the elements making them up, Mercury would be the densest planet. Mercury has a higher proportion of elements that are higher on the periodic table compared to any other known world in the Solar System. Even the asteroids that have had their volatile ices boiled off aren't as dense as Mercury is based on elements alone. Venus is #2, Earth is #3, followed by Mars, some asteroids, and then Jupiter's innermost moon: Io.
But it isn't just the raw material composition of a world that determines its density. There is also the issue of gravitational compression, which has a greater effect on worlds the larger their masses are. This is something we've learned a lot about by studying planets beyond our own Solar System, as they've taught us what the different categories of an exoplanet are. That's allowed us to infer what physical processes are at play that leads to the worlds we observe.
If you are below about two Earth masses, you are going to be a rocky, terrestrial-like planet with greater mass planets experiencing more gravitational compression. Above that, you start hanging onto a gaseous envelope of matter which puffs your world out and drops its density tremendously as you go up in mass, explaining why Saturn is the least dense planet. Above another threshold, gravitational compression takes the lead again. Saturn is 85% the physical size of Jupiter but only one-third the mass. And beyond another threshold, nuclear fusion ignites, transforming a would-be planet into a star.
If we had a world like Jupiter that was close enough to the Sun, its atmosphere would be stripped away revealing a core that would certainly be denser than any of the planets in our Solar System today. The densest, heaviest elements always sink to the core during planet formation and gravitation compresses that core to be even denser than it would have been otherwise. But we don't have any such world in our backyard.
Instead, we just have a relatively heavy rocky, terrestrial planet Earth, the heaviest world in our Solar System without a large gaseous envelope. Due to the power of its own gravitation, Earth is compressed by a few percent over what its density would have been without so much mass. The difference is enough to overcome the fact that it's made of lighter elements overall than Mercury is (by somewhere between 2-5%) to make it about 2% denser than Mercury overall.
If the elements you were made out of were the only metric that mattered for density, then Mercury would be the densest planet in the Solar System without a doubt. Without a low-density ocean or atmosphere and made out of heavier elements on the periodic table (on average) than any other object in our neighborhood, it would take the cake. And yet Earth, nearly three times as distant from the Sun made out of lighter materials and with a substantial atmosphere, squeaks ahead with a 2% greater density.
The explanation? Earth has enough mass that its self-compression due to gravitation is significant almost as significant as you can get before you start hanging onto a large volatile envelope of gases. Earth is closer to that limit than anything else in our Solar System and the combination of its relatively dense composition and its enormous self-gravity as we are 18 times as massive as Mercury places us alone as the densest object in our Solar System.