Igneous rock forms from cooling magma or lava. Sedimentary rock forms from compression and cementation of sediments like sand and shells. Metamorphic rock forms from changes to existing rock by heat, pressure, and chemical reactions in the Earth's crust.