Rocks are naturally occurring mixtures that can be divided into three main types - igneous, sedimentary, and metamorphic - based on their formation process. Igneous rocks form from cooling magma or lava. Sedimentary rocks form through the compaction or cementation of sediments. Metamorphic rocks form from changes to existing rocks through heat, pressure, and other processes in the Earth. Rocks continually change between these types through the rock cycle as they are weathered, eroded, melted, cooled, and compacted over time.