CSS unit converters
Convert between any two CSS length units. rem, em and % are worked out from the root font size, which you can set to match your project.
Runs on your devicenothing is uploadedHow to check
More detailsThe units · Absolute vs relative · The accessibility argument for rem
The units
| Unit | Type | In pixels (16 px base) |
|---|---|---|
px | Absolute | 1 px |
rem | Relative | 16 px |
em | Relative | 16 px |
pt | Absolute | 1.3333 px |
pc | Absolute | 16 px |
in | Absolute | 96 px |
cm | Absolute | 37.7953 px |
mm | Absolute | 3.7795 px |
% | Relative | 0.16 px |
Absolute vs relative
Absolute units (px, pt, pc, in, cm, mm) always render at the same size regardless of context. Relative units (rem, em, %) are computed from a font size — the root element for rem, the current element for em and percent — which is what makes them respond to user preferences and to a responsive type scale.
The accessibility argument for rem
When a visitor raises their browser's default font size, text sized in px does not move. Text sized in rem does. That single difference is why almost every modern design system expresses type and spacing in rem and reserves px for borders and one-pixel details.