Pixel density measures how many pixels occupy a specified physical length or area. For a flat display with square, uniformly spaced pixels, its linear pixel density is often expressed as pixels per inch. Its reciprocal is the pixel pitch, the physical separation between corresponding points of neighbouring pixels.
If the display has horizontal and vertical counts and diagonal measured in inches, the Pythagorean theorem gives the linear pixel densityA hypothetical display with a diagonal has pixels per inch. Its pixel pitch is . At the same pixel counts, halving the diagonal doubles the linear pixel density and quadruples the number of pixels per unit area. These calculations assume the quoted diagonal is the active image area.
A stored image's pixel counts do not determine its physical size without a display or printing scale. Likewise, a CSS
px is a layout unit rather than a promise of one physical display pixel. CSS fixes 96px = 1in within its unit system, but the mapping onto physical display pixels depends on the chosen anchor and device. That ratio cannot be used to infer a screen's measured pixel density.[ref] New to topics? Read the docs here!