Although the Sun does heat the surface of the Earth, the heat from inside the Earth is not caused by the Sun. The geothermal energy of the Earth's crust comes 20% from the original formation of the planet, and 80% from the radioactive decay of minerals. The Earth is hottest at its core and, from the core to the surface, the temperature gets gradually cooler.