Formation of the Solar System

Our solar system consists of one star (the Sun), eight planets and all their moons, three dwarf planets, and several thousand small solar system objects—asteroids, comets, trans-Neptunian objects, and other small bodies. The Sun's age was calculated in 1989 to be 4.5 billion years old, less than the 4.7 billion years previously believed. It was formed from a cloud of hydrogen mixed with small amounts of other substances that had been produced in the bodies of other stars before the Sun was born. This was the parent cloud of the solar system. The dense, hot gas at the center of the cloud gave rise to the Sun; the outer regions of the cloud—cooler and less dense—gave birth to the planets.

This video shows how a solar system forms.
Video courtesy of NASA