Flexi Says: The three main rock types are igneous, sedimentary, and metamorphic. Igneous rocks form from cooling magma. The chemical composition of the magma and the rate at which it cools determine what rock forms as the minerals cool and crystallize. Sedimentary rocks form by the compaction and cementing together of sediments, broken pieces of rock-like gravel, sand, silt, or clay. Those sediments can be formed from the weathering and erosion of preexisting rocks. Sedimentary rocks also include chemical precipitates, the solid materials left behind after a liquid evaporates. Metamorphic rocks form when the minerals in an existing rock are changed by heat or pressure within the Earth.