The internal heat of the Earth is a result of radioactive decay and residual heat. The gravitational energy left over from Earth’s formation represents around 10 percent of Earth’s internal heat, whereas the majority of heat comes from the radioactive decay of chemical elements.
The compression of cosmic debris that led to the formation of Earth about 4.6 billion years ago generated a lot of heat, most of which has not completely dissipated. Inside the Earth’s core, the radioactive decay of certain isotopes of elements such as uranium and potassium releases energy in the form of heat. This heat then slowly migrates towards the surface of the Earth and is released through volcanic activity.