The Solar System formed 4.6 billion years ago from a giant molecular cloud. It comprises the Sun and eight planets along with their moons, asteroids, and comets. The vast majority of the system's mass is contained in the Sun, with most of the remaining mass in Jupiter. The inner planets Mercury, Venus, Earth, and Mars are rocky, while the outer planets Jupiter, Saturn, Uranus, and Neptune are composed primarily of gas.