Magma oceans are vast fields of surface magma that exist during periods of a planets or some natural satellites accretion when the celestial body is completely or partly molten. 
In the early Solar System, magma oceans were formed by the melting of planetesimals and planetary impacts. Small planetesimals are melted by the heat provided by the radioactive decay of aluminium-26. As planets grew larger, the energy was then supplied from giant impacts with other planetary bodies. Magma oceans are integral parts of planetary formation as they facilitate the formation of a core through metal segregation and an atmosphere and hydrosphere through degassing. Evidence exists to support the existence of magma oceans on both the Earth and the Moon. Magma oceans may survive for millions to tens of millions of years, interspersed by relatively mild conditions.