Based on the OBD wiki:

Want to find out how much energy it takes to blow up a planet? This is the way to do it. Gravitational Binding Energy is defined as the amount of energy it would take to scatter the mass of a gravitationally bound body to the point that its own gravity will not pull it back together again. There are precise calculations for this via integration, but a good approximation can be achieved with the following formula:

Gravitational Binding Energy

Gravitational Binding Energy

basic GBE formula

Where U = GBE, M = the mass of the body in question, r = its radius, and G = the gravitational constant.

Ignoring this formula often leads to vast underestimates of the energy required to destroy astronomical objects (for example, some people assume it scales linearly with mass or volume).

Please note that this formula only works on objects that are mostly held together by their own gravity (meaning: large objects in space such as asteroids, moons, planets, stars, etc.) It also doesn't work on black holes, for obvious reasons.

List of approximate GBE values for various objects:

-Earth's moon (Luna): 1.24e29j

-Earth: 2.24e32j (calculated with a more accurate method than the above formula)

-The sun (Sol): 6.87e41j

-Average neutron star: 5.23e46j's Planetary Parameter Calculator gives a simplified approach to finding a celestial body's GBE with diameter or gravity mods, for FXSolver , gives one control over the Mass and Radius mods.

This applies for Implosions of planets as well if said planet actually is destroyed and cannot be bound by gravity anymore.