Gravitational binding energyThe gravitational binding energy of an object is the amount of energy required to accelerate every component of that object to the escape velocity of every other component. It is also the amount of energy that is liberated (usually in the form of heat) during the accretion of such an object from material falling from infinity.
For a uniform, spherical mass, the gravitational binding energy is
Assuming that Earth is uniform (which is not correct, but is close enough to get an order-of-magnitude estimate) with M = 5.97×1024kg and r = 6.37×106m, U is 2.24×1032J. This is roughly equal to one week of the Sun's total energy output.