Geologists classify rocks based on how they are formed and the elements they contain. There are three main categories of rocks: igneous, sedimentary and metamorphic.
Each of the three main groups may be broken down into several categories, depending on a variety of factors.
Igneous rocks are formed when volcanic magma cools and crystallizes into rock. When magma cools beneath the Earth's surface, the resulting rocks are considered plutonic, while rocks that form when lava cools above the Earth's crust is volcanic rock.
Sedimentary rocks are developed from materials that were deposited on the Earth's surface. Although the materials are deposited on the surface, the resulting rocks can be formed either directly on the surface or deep within the planet. Most sedimentary rocks are formed over millions of years under the surface, due to the high pressure underneath the earths crust.
Metamorphic rocks are formed when either igneous or sedimentary rocks undergo a chemical transformation deep within the earth. This transformation occurs as a result of heat and pressure, which chemically alters the original rock, known as the protolith, into a new form. In some cases, the protolith can be another metamorphic rock, but at some point it came from either an igneous or sedimentary rock.