Igneous rocks are formed from the cooling and solidification of molten rock (magma or lava). Metamorphic rocks are formed by the transformation of existing rocks due to heat and pressure, and sedimentary rocks are formed from the accumulation and cementation of sediments.