The planets formed by accretion from this disc, in which dust and gas gravitated together and coalesced to form ever larger bodies. Due to their higher boiling points, only metals and silicates could exist in solid form closer to the Sun, and these would eventually form the terrestrial planets of Mercury, Venus, Earth, and Mars. Because metallic elements only comprised a very small fraction of the solar nebula, the terrestrial planets could not grow very large.

In contrast, the giant planets (Jupiter, Saturn, Uranus, and Neptune) formed beyond the point between the orbits of Mars and Jupiter where material is cool enough for volatile icy compounds to remain solid (i.e. the Frost Line). The ices that formed these planets were more plentiful than the metals and silicates that formed the terrestrial inner planets, allowing them to grow massive enough to capture large atmospheres of hydrogen and helium.

The leftover debris that never became planets congregated in regions such as the Asteroid Belt, the Kuiper Belt, and the Oort Cloud. So this is how and why the Solar System formed in the first place. Why is it that the larger objects formed as spheres instead of say, squares? The answer to this has to do with a concept known as hydrostatic equilibrium.