| CSS ems (em) | CSS pixels (px) |
|---|---|
| 1 CSS em | 16 px |
| 2 CSS ems | 32 px |
| 3 CSS ems | 48 px |
| 4 CSS ems | 64 px |
| 5 CSS ems | 80 px |
| 10 CSS ems | 160 px |
| 20 CSS ems | 320 px |
| 25 CSS ems | 400 px |
| 50 CSS ems | 800 px |
| 100 CSS ems | 1600 px |
| Reference | CSS ems (em) | CSS pixels (px) |
|---|---|---|
| Standard printed book body text | 0.916667 em | 14.6667 px |
| Default browser root font size | 1 em | 16 px |
| Minimum accessible mobile tap target | 3 em | 48 px |
| One CSS reference inch | 6 em | 96 px |
The CSS em is a font-relative length unit in the W3C CSS specification, equal to the computed font size of the element on which it is used — or, inside the font-size property itself, the computed font size of the parent element. Its symbol is em. At the standard 16-pixel browser default without nested scaling, 1 em equals 16 CSS pixels.
The name descends from hot-metal typesetting, where the capital letter M sat on an approximately square lead block whose width matched the point size of the fount. Printers called that square spacing piece an em quad — or mutton, to distinguish it aloud from the narrower en quad, or nut — and set indents, dashes and spaces in ems so proportions stayed balanced at every type size.
CSS adopted em in its original 1996 specification for scalable web typography. On font-size declarations, however, parent-relative inheritance compounds across nested layers: a 1.25 em list inside a 1.25 em panel renders at 1.5625 times the base size. That quirk inspired root-relative rem, yet local proportionality remains em's distinctive strength elsewhere.
Applied to padding, margins, border radii or inline icons, em binds a component's geometry directly to its own text size. A button styled with 0.5 em vertical and 1.25 em horizontal padding keeps balanced breathing room whether rendered as a compact 13-pixel tag or a 24-pixel hero banner, needing no extra override rules. Paragraph indents of 1.5 em and reading measures of 30 to 40 em carry centuries of book craft directly to screens.
Inside CSS media queries, browsers evaluate em against the user's default font preference rather than page overrides, letting responsive layouts adapt cleanly when readers enlarge browser text.
Outside a live element tree, converters use the universal 16-pixel unscaled browser baseline, matching twelve points and one pica.
One CSS em equals 16 CSS pixels (at the standard 16-pixel browser default), 12 points, 1 pica, 1 CSS rem, 240 twips, about 4.2333 CSS millimetres, or about 0.1667 CSS inches.
The CSS pixel is the canonical length unit of Cascading Style Sheets and modern web interface layout. Its symbol is px. Belonging to the W3C CSS layout system rather than describing a single hardware dot, it is defined simultaneously as an optical reference angle and as exactly 1/96 of a CSS inch.
That dual definition solves a problem physical pixels alone could never handle. The W3C defines the reference pixel as the visual angle of one pixel on a 96-dots-per-inch screen held at an arm's length of 28 inches (about 71 centimetres) — roughly 0.0213 degrees. Anchoring layouts to angular size lets a 16-pixel typeface appear broadly comparable on a smartphone held close, a laptop on a desk and a television across a room.
The 96-pixel-per-inch baseline is a piece of computing history. Early Macintosh monitors ran at 72 dots per inch so one screen dot matched one typographical point, whereas Microsoft chose 96 logical dots per inch for Windows in the 1980s to give small letters extra vertical strokes on coarse displays. When CSS 2.1 locked absolute units together, the Windows figure became the universal web constant.
On modern Retina, 4K and smartphone displays, the gap between CSS pixels and physical device pixels is decisive. A screen with a device pixel ratio of two or three paints each CSS pixel across a 2-by-2 or 3-by-3 grid of hardware subpixels, preserving comfortable layout proportions while giving letterforms and icons print-like sharpness.
Everyday web conventions centre on familiar pixel benchmarks. Browsers default body copy to 16 px; accessibility guidelines recommend tap targets of 44 to 48 px; interface icons step through 16, 24, 32 and 48 px; and responsive breakpoints commonly cluster around 768, 1024 and 1280 px.
Because browsers tie every absolute CSS length back to the pixel grid on screen, px remains the shared currency between design tools, front-end code and bitmap imagery.
One CSS pixel equals 0.75 points, 15 twips, 0.0625 picas, 0.0625 CSS rems or ems at the standard 16-pixel browser default, about 0.2646 CSS millimetres, or about 0.01042 CSS inches.