PX ⇄ REM Converter
Convert pixels to rem (and to em and pt) and back, using a configurable root font size. Type in any field and the rest update live — handy for writing responsive, accessible CSS. Runs in your browser.
em here is calculated the same as rem (relative to the base) — for nested em, multiply by the parent's font size.
FAQ
How do I convert px to rem?
Divide the pixel value by the root font size (16px by default): 24px ÷ 16 = 1.5rem. Type a px value and the rem, em and pt update instantly; change the base if your root font isn't 16px.
rem vs em?
rem is relative to the root (html) font size — consistent page-wide. em is relative to the parent's font size, so it compounds when nested. rem is usually safer for spacing and type.
Why use rem instead of px?
rem respects the user's browser font-size setting, so layouts scale for larger default text — better accessibility — and site-wide type scaling becomes a one-line change.
What base font size should I use?
Browsers default to 16px, the standard base. Change it only if your CSS sets a different html font-size.
More tools: CSS box-shadow generator, CSS border-radius generator, and the full tools list.