Unlike gas-giant planets, we lack examples of terrestrial planets orbiting other Sun-like stars to help us understand how they formed. We can draw hints from elsewhere though. Astronomical observations of young stars; the chemical and isotopic compositions of Earth, Mars and meteorites; and the structure of the Solar System all provide clues to how the inner rocky planets formed. These data have inspired and helped to refine a widely accepted model for terrestrial planet formation—the planetesimal hypothesis. In this model, the young Sun is surrounded by a disk of gas and fine dust grains. Grains stick together to form mountain-size bodies called planetesimals. Collisions and gravitational interactions between planetesimals combine to produce a few tens of Moon-to-Mars-size planetary embryos in roughly 0.1-1 million years. Finally, the embryos collide to form the planets in 10-100 million years. One of these late collisions probably led to the formation of Earth's Moon. This basic sequence of events is clear, but a number of issues are unresolved. In particular, we do not really understand the physics of planetesimal formation, or how the planets came to have their present chemical compositions. We do not know why Mars is so much smaller than Earth, or exactly what prevented a planet from forming in the asteroid belt. Progress is being made in all of these areas, although definitive answers may have to wait for observations of Earth-like planets orbiting other stars.