CSS keeps adding units — viewport, container, and the small/large/dynamic viewport variants — and the relative ones depend on context that is easy to get wrong. This reference lists every common unit with its basis and includes a live converter for the length units you switch between most.
How it works
The converter takes a px length plus the values that the relative units depend on:
the root font-size for rem, the element font-size for em, and the viewport
size for vw and vh. It divides accordingly and also derives the print units
using CSS’s fixed anchor of 1in = 96px (so 1pt = 96/72 px and
1cm = 96/2.54 px). The reference table tags each unit by type and explains its
basis; the search box matches the unit, type, description, and basis.
Tips and notes
- Prefer
remfor type and spacing so a single root font-size scales the whole UI; reach foremwhen you want a value to track the local font-size. - Use
dvh(orsvh/lvh) instead ofvhfor full-height mobile layouts to avoid the address-bar overflow problem. - Container units (
cqw,cqi, …) only resolve inside an element with a declaredcontainer-type; otherwise they fall back to viewport sizing. - Absolute units are consistent with px on screen but only physically accurate in print.
The relative conversions above are exact given the basis values you enter; change the root or viewport fields to match your own stylesheet.