The density of a rock is closely tied to its mineralogy. Sedimentary rocks have a lower density than igneous rocks, with most sandstones having a density close to the density of quartz (ρ = 2.65 g/cm3), suggesting that they are composed primarily of quartz grains and cement. Sandstones with higher densities are composed of quartz mixed with denser minerals such as calcite (ρ = 2.71 g/cm3) and dolomite (ρ = 2.8 to 3.1 g/cm3).
Amongst igneous rocks, mafic rocks contain the high-density minerals pyroxene and olivine, and are thus more dense than felsic rocks which contain more of the lower-density minerals quartz and feldspar. As oceanic crust is primarily mafic rocks like basalt and peridotite, while continental crust is primarily felsic rocks like granite, therefore oceanic rocks are generally more dense than continental rocks.
Similarly, metallic ores are usually more dense than quartz-rich crustal rocks due to a larger component of heavy metallic minerals. The large portion of light ions like hydrogen and sodium in evaporites like salt mean that evaporites have a lower density than crustal rocks. As salt caps are associated with petroleum deposits, this density difference makes gravity surveying effective for petroleum fields. More complex environments such as glacial deposits exhibit a substantial range in density: fluvial-glacial deposits of fine, dry sands are less dense than glacial moraines of cobbles and rocks.
Water content impacts density, both by permeating void space or by absorption into the material structure, potentially leading to substantial changes between dry and wet densities. Porous rocks above the water table are less dense than the same rocks below the water table, as water infills the pores. Clay can absorb substantial amount of water, swelling in volume while also increasing in density.
The grain density of a material is an indicator of the mineralogy. A rock like shale is composed of several minerals of different densities including dolomite (ρ = 2.8 to 3.1 g/cm3), calcite (ρ = 2.71 g/cm3), and clays like illite (ρ = 2.6 to 2.9 g/cm3) and kaolinite (ρ = 2.6 g/cm3). The grain density of shale (ρ = 2.65 to 2.8 g/cm3) is then a combination of these mineral densities at different proportions.