Porosity or void fraction is a measure of the void (i.e. "empty") spaces in a material, and is a fraction of the volume of voids over the total volume, between 0 and 1, or as a percentage between 0% and 100%. Strictly speaking, some tests measure the "accessible void", the total amount of void space accessible from the surface (cf. closed-cell foam).

There are many ways to test porosity in a substance or part, such as industrial CT scanning.

The term porosity is used in multiple fields including pharmaceutics, ceramics, metallurgy, materials, manufacturing, hydrology, earth sciences, soil mechanics and engineering.

Optical method of measuring porosity: thin section under gypsum plate shows porosity as purple color, contrasted with carbonate grains of other colors. Pleistocene eolianite from San Salvador Island, Bahamas. Scale bar 500 μm.

Several methods can be employed to measure porosity: