The planets formed from a disc of cosmic dust rotating around the Sun. The composition of the planets varies. Those nearest the Sun are made of rock, while those most distant are made of gases.