Porosity is a measure of the void spaces in a material, and is a fraction of the volume of voids over the total volume, between 0–1, or as a percentage between 0–100%. The term is used in multiple fields including pharmaceutics, ceramics, metallurgy, materials, manufacturing, earth sciences and construction.
Contents 
Used in geology, hydrogeology, soil science, and building science, the porosity of a porous medium (such as rock or sediment) describes the fraction of void space in the material, where the void may contain, for example, air or water. It is defined by the ratio:
where V_{V} is the v of voidspace (such as fluids) and V_{T} is the total or bulk volume of material, including the solid and void components. Both the mathematical symbols φ and n are used to denote porosity.
Porosity is a fraction between 0 and 1, typically ranging from less than 0.01 for solid granite to more than 0.5 for peat and clay, although it may also be represented in percent terms by multiplying the fraction by 100.
The porosity of a rock, or sedimentary layer, is an important consideration when attempting to evaluate the potential volume of water or hydrocarbons it may contain. Sedimentary porosities are a complex function of many factors, including but not limited to: rate of burial, depth of burial, the nature of the connate fluids, the nature of overlying sediments (which may impede fluid expulsion). One commonly used relationship between porosity and depth is given by the Athy (1930) equation:
where φ_{0} is the surface porosity, k is the compaction coefficient (m^{−1}) and z is depth (m).
A value for porosity can alternatively be calculated from the bulk density ρ_{bulk} and particle density ρ_{particle}:
Normal particle density is assumed to be approximately 2.65 g/cm³, although a better estimation can be obtained by examining the lithology of the particles.
Porosity is indirectly related to hydraulic conductivity; for two similar sandy aquifers, the one with a higher porosity will typically have a higher hydraulic conductivity (more open area for the flow of water), but there are many complications to this relationship. Clays, which typically have very low hydraulic conductivity also have very high porosities (due to the structured nature of clay minerals), which means clays can hold a large volume of water per volume of bulk material, but they do not release water rapidly.
Well sorted (grains of approximately all one size) materials have higher porosity than similarly sized poorly sorted materials (where smaller particles fill the gaps between larger particles). The graphic illustrates how some smaller grains can effectively fill the pores (where all water flow takes place), drastically reducing porosity and hydraulic conductivity, while only being a small fraction of the total volume of the material. For tables of common porosity values for earth materials, see the "further reading" section in the Hydrogeology article.
Consolidated rocks (e.g. sandstone, shale, granite or limestone) potentially have more complex "dual" porosities, as compared with alluvial sediment. The rock itself may have a certain (low) porosity, and the fractures (cracks and joints), or dissolution features may create a second (higher) porosity. The interaction of these porosities is complex and often makes simple models highly inaccurate.
Porosity of surface soil typically decreases as particle size increases. This is due to soil aggregate formation in finer textured surface soils when subject to soil biological processes. Aggregation involves particulate adhesion and higher resistance to compaction. Typical bulk density of sandy soil is between 1.5 and 1.7 g/cm³. This calculates to a porosity between 0.43 and 0.36. Typical bulk density of clay soil is between 1.1 and 1.3 g/cm³. This calculates to a porosity between 0.58 and 0.51. This seems counterintuitive because clay soils are termed heavy, implying lower porosity. Heavy apparently refers to a gravitational moisture content effect in combination with terminology that harkens back to the relative force required to pull a tillage implement through the clayey soil at field moisture content as compared to sand.
Porosity of subsurface soil is lower than in surface soil due to compaction by gravity. Porosity of 0.20 is considered normal for unsorted gravel size material at depths below the biomantle. Porosity in finer material below the aggregating influence of pedogenesis can be expected to approximate this value.
Soil porosity is complex. Traditional models regard porosity as continuous. This fails to account for anomalous features and produces only approximate results. Furthermore it cannot help model the influence of environmental factors which affect pore geometry. A number of more complex models have been proposed, including fractals, bubble theory, cracking theory, Boolean grain process, packed sphere, and numerous other models. See also Characterisation of pore space in soil.
Several methods can be employed to measure porosity:
where:


