There are three main types of rocks: sedimentary, igneous, and metamorphic. Sedimentary rocks form from compacted and cemented sediments and sometimes contain fossils. Igneous rocks form from cooled magma, with extrusive rocks cooling above ground quickly and intrusive rocks cooling below ground slowly. Metamorphic rocks form from other rocks being heated and compressed, creating new rock types with interlocking crystals or foliation.