CSS pixel 2026-11-05
A CSS pixel, written
px, is a unit of length in CSS layout. Its reference definition concerns a visual angle, while the specification fixes the ratios between CSS absolute length units:within the CSS unit system. The browser can anchor these units to physical measurements or to a reference pixel appropriate to the output medium. Consequently, a CSS pixel does not necessarily equal one physical display pixel.[ref]CSS Values and Units Module Level 3 by World Wide Web Consortium. §5.2, Absolute Lengths, unit table, anchoring rules and reference-pixel definition
For example, a box with
width: 100px has a declared width of 100 CSS pixels. On a display mapping two device pixels to each CSS pixel along each axis, that width spans 200 device pixels before any additional transforms. A square of side 100 CSS pixels spans a device-pixel region in that simple mapping. The device pixel ratio connects these two coordinate scales.The fixed ratio
96px = 1in does not measure a monitor's physical pixel density. A browser's on-screen 1in can differ from a measured physical inch when the reference-pixel anchor is used. Page zoom can also change the physical size of the layout's CSS pixels, even though the declared number 100px remains the same.[ref] Device pixel ratio 2026-11-05
The device pixel ratio expresses the size of one CSS pixel relative to one physical device pixel. The CSSOM View Module by World Wide Web Consortium defines
window.devicePixelRatio as the current CSS pixel size divided by the output device's vertical pixel size, with page zoom included in the former:The numerator and denominator are physical lengths, so the ratio is dimensionless.[ref]At , a CSS pixel region corresponds to device pixels in a uniform mapping. The linear counts double, while the pixel count scales by . A raster drawing surface can therefore need four times as many stored pixels to supply one sample per device pixel while retaining the same layout size. An existing low-resolution image does not gain missing detail merely because the display has a larger ratio.
The ratio need not be an integer. A ratio such as means that a one-CSS pixel boundary need not align with the physical grid, so rasterization has to distribute coverage. Increasing page zoom changes the size of a CSS pixel and can change the reported ratio. Pinch zoom scales the visual view without redefining the layout pixel in the same way; it is a separate scale.[ref]
CSSOM View Module by World Wide Web Consortium. §2.2, Zooming, distinction between page zoom and visual-viewport scale; devicePixelRatio algorithm
Pixel density in pixels per physical inch and device pixel ratio consequently answer different questions: the former describes a physical grid, while the latter describes its mapping from the browser's layout scale.
Page zoom 2026-11-05
Page zoom changes a browser page's layout scale by changing the physical size associated with a CSS pixel. The browser can consequently fit fewer layout units into the available display area and recompute line wrapping and other width-dependent layout. Pinch zoom, represented by the visual viewport scale, magnifies an already laid-out view instead.[ref]
CSSOM View Module by World Wide Web Consortium. §2.2, Zooming: page zoom affects initial viewport size while visual scale acts as a magnifying glass
For an illustrative fixed device width of 800 physical pixels, suppose the initial device pixel ratio is . The width corresponds to 400 CSS pixels. At page-zoom multiplier , with other scaling held fixed, each layout pixel spans four device pixels, so the available width is 200 CSS pixels:A box declared as
width: 100px still has that declared width, but its physical display width increases. A percentage-width box or a line of text can respond to the changed containing width instead.The device pixel ratio API includes the current page zoom when comparing a layout pixel with an output-device pixel. A scale caused by pinch zoom is tracked separately. Reading the ratio alone therefore does not reveal every magnification affecting what a user sees.[ref]
CSSOM View Module by World Wide Web Consortium. Window.devicePixelRatio algorithm, CSS pixel size at current page zoom; VisualViewport scale
These equations describe a uniform idealized mapping with fixed display geometry. Browser chrome, available viewport area and extra transforms can change a concrete measurement. The central distinction is which coordinate scale changes: layout is recomputed at a different CSS-to-device mapping under page zoom.
Pinch zoom 2026-11-05
Pinch zoom magnifies a browser's visual view of a page while leaving its layout scale unchanged. The specification describes this through the visual viewport scale factor, which acts like a magnifying glass over the layout viewport. A pinch gesture is a common way to control the scale, but the same visual magnification can be triggered through other interface behavior.[ref]
CSSOM View Module by World Wide Web Consortium. §2.2, Zooming, visual-viewport scale and note on pinch gestures
For example, suppose the device shows 800 physical pixels across, with device pixel ratio and no initial visual magnification. The visible width is then 400 CSS pixels. At a visual scale , the same device width displays only 200 CSS pixels of that existing layout. The user can pan across the enlarged page. A paragraph laid out at a given CSS width does not acquire a new layout width merely because it is viewed through the magnification.
In this simple uniform mapping, a layout length spansdevice pixels. For CSS pixels, and , the displayed span is 400 device pixels. Additional transforms or browser interface geometry require their own accounting.
Page zoom instead changes the physical size of a layout CSS pixel and can affect layout and the reported device pixel ratio. Pinch zoom does not redefine that ratio in the same way. Combining the two scale factors silently can therefore produce incorrect pointer positions, image-resolution choices or measurements.[ref]
CSSOM View Module by World Wide Web Consortium. §2.2 and Window.devicePixelRatio algorithm; VisualViewport scale attribute
Pixel pitch 2026-11-05
Pixel pitch is the physical spacing between corresponding centres of neighbouring pixels on a display or sensor grid. For an axis-aligned rectangular grid it can have separate horizontal and vertical values . The pixel pitch describes the grid spacing, rather than the number of bits used for each pixel value.[ref]
Pixel Pitch and Enlarged Mode by EIZO. Opening definition of pixel pitch and comparison of physical text size at different densities
For square pixels on a uniform grid, linear pixel density and pixel pitch are reciprocal. If is measured in pixels per inch,For example, a hypothetical matrix with 2400 columns occupying a active width has and horizontal pixel density pixels per inch. This calculation treats the width as the edge-to-edge extent of 2400 equal pixel cells; the distance from the first centre to the last centre is instead .
Doubling the column count over the same width halves the horizontal pixel pitch. Doubling both row and column counts quadruples the number of pixels per unit area. The dimensions and the direction being measured therefore matter when comparing specifications.
A smaller pixel pitch provides a finer sampling grid, but it cannot recover detail already lost from the input image. Optical blur, aliasing and the viewing geometry also affect visible detail. A CSS pixel is a layout unit, so its size must be mapped through the device pixel ratio before it can be related to this physical grid.
Point (typography) 2026-11-05
A typographic point is a unit used for font size, line height and other typographic distances. In the modern digital convention,Here the inch is 25.4 millimetres. The equation describes the digital convention; historical typographic point systems have not all used that same length. The modern
pt relation also appears among the absolute-length units defined for CSS.[ref]CSS Values and Units Module Level 3 by World Wide Web Consortium. Section5.2: absolute lengths and the pt, in and px equivalences
For example, a font size of 12 typographic points corresponds to a nominal em of one sixth of an inch, approximately 4.2333 millimetres. That sets the outline's scale, rather than the exact ink height of every glyph. A particular x-height or glyph advance can be a different fraction of an em.
The CSS conversion also gives 12 typographic points as 16 CSS pixels. A CSS pixel is a layout unit, so this equality does not promise 16 hardware pixels or a ruler-measured physical height on every screen. Zoom and the mapping to device pixels must be accounted for separately; the device pixel ratio records one part of that mapping.
Visual viewport 2026-11-05
The visual viewport is the region of the laid-out page currently visible through a browser's view, described by its size, offset and scale. It can show only part of the layout viewport, especially during pinch zoom. The specification exposes this state through the
VisualViewport interface.[ref]CSSOM View Module by World Wide Web Consortium. Viewports and The VisualViewport Interface, size, offset and scale
For example, take a layout 400 CSS pixels wide on a display mapping two device pixels to each layout pixel. A visual magnification of two can show only 200 CSS pixels across the same 800-device-pixel area. Panning changes which interval of the layout is visible without requiring the layout itself to become 200 pixels wide.
A simple horizontal coordinate conversion illustrates the need for both offset and scale. If a point has coordinate relative to the layout viewport and the visual view starts at offset , then, with uniform mapping,where is the device pixel ratio and the visual scale. With , , and , the point appears 200 device pixels from the visual view's left edge. Additional transforms and browser geometry need separate treatment.
Page zoom can change the physical mapping of layout CSS pixels, whereas the visual viewport scale is tracked separately. A program placing an overlay or translating an interaction coordinate must therefore identify its coordinate origin and units before combining measurements.[ref]
CSSOM View Module by World Wide Web Consortium. Zooming; VisualViewport offsetLeft and scale; Window.devicePixelRatio