This is one of most creative diagrams that I’ve ever seen: the depth of various solar system gravity wells. A large version of this image can be accessed at http://xkcd.com/681_large/.
From the fine print:
Each well is scaled so that rising out of a physical well of that depth — in constant Earth surface gravity — would take the same energy as escaping from that planet’s gravity in reality.
It takes the same amount of energy to launch something on an escape trajectory away from Earth as it would to launch is 6,000 km upward under a constant Earth gravity. Hence, Earth’s well is 6,000 km deep.
Here’s some more details about the above formula.
Step 1. The escape velocity from the surface of a spherical planet is
where is the universal gravitational constant, is the mass of the planet, and is the radius of the planet. Therefore, the kinetic energy needed for a rocket with mass to achieve this velocity is
Step 2. Suppose that a rocket moves at constant velocity upward near the surface of the earth. Then the force exerted by the rocket exactly cancel the force of gravity, so that
where is the acceleration due to gravity near Earth’s surface. Also, work equals force times distance. Therefore, if the rocket travels a distance against this (hypothetically) constant gravity, then
The depth formula used in the comic is then found by equating these two expressions and solving for .