The inner planets, Mercury, Venus, Earth and Mars, are made up of silicate rock and heavy metals such as iron and nickel, whereas the outer planets, Jupiter, Saturn, Uranus and Neptune, are made up mostly of gases, according to Universe Today. The outer planets are subdivided into gas giants, comprised mostly of hydrogen and helium, and ice giants, comprised mostly of methane, ammonia and water.
Despite being made up mostly of gases, the outer planets have a rock core. However, they are still less dense and located further away from the sun than the inner or terrestrial planets. Astronomers are able to to determine how planets formed by studying the structure of the solar system and other younger planetary systems that are in varying stages of development.
The dominant theory, according to HowStuffWorks, states that solar wind emanating from the sun blew light elements, mostly gases, away into the outer orbits. Gravity then drew these elements in causing them to form giant balls. The discovery of hot Jupiters in 1995, however, put a dent in this theory. Hot Jupiters are a type of gas giant that orbit very close to the sun. Astronomers theorize that such planets form far away from the sun and then move closer through orbital migration.