= Pixel density
{wiki}
<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 $N_x,N_y$ and diagonal $D$ measured in <inches>, the <Pythagorean theorem> gives the linear <pixel density>
$$
\rho=\frac{\sqrt{N_x^2+N_y^2}}{D}.
$$
A hypothetical $1920\times1080$ display with a $24\,\mathrm{in}$ diagonal has $2202.91/24\approx91.8$ pixels per <inch>. Its <pixel pitch> is $25.4/91.8\approx0.277\,\mathrm{mm}$. 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>.<CSS Values and Units Module Level 3 by World Wide Web Consortium>[§5.2, Absolute Lengths: fixed unit ratios, anchoring to physical units or reference pixel, and distinction from device pixels]{ref}
Back to article page