px โ rem
rem = px รท root. Change the root if your html font-size is not 16px.
How to use the px โ rem
What does the px โ rem do?
Convert CSS pixels to rem and back; It applies this page-specific rule: a rem is one times the font-size of the root element (html).
Which inputs does this tool use?
To convert css pixels to rem and back, enter Root (px), px, rem; keep every value in the same example; the page then updates the result from the current values; Start with a familiar case covered by this rule - em is different: it is relative to the parent, so it compounds when nested - so the expected result can confirm the settings.
How should the tool result be read?
For a result intended to convert css pixels to rem and back, em is different: it is relative to the parent, so it compounds when nested; read rem together with the original root (px) rather than as an isolated answer, and confirm that its units or structure match the intended use.
Why 16?
When the goal is to convert css pixels to rem and back, browser default for html.
Is rem the same as em?
When using the page to convert css pixels to rem and back, no.
Limits and accuracy
When using this tool to convert css pixels to rem and back, use rem when you want spacing and type to scale with the userโs browser font-size; check the result in its intended destination before relying on it for important work; keep root (px) until the output has been checked in its intended destination. For a repeatable check when you need to convert css pixels to rem and back, record Root (px) alongside the final output and selected options. A known example using root (px) can confirm how the page will convert css pixels to rem and back.
How this works
A rem is one times the font-size of the root element (html). Browsers default that to 16px, so 24px = 1.5rem and 10px = 0.625rem. If you set html { font-size: 18px }, every rem on this page should use 18 as the root.
em is different: it is relative to the parent, so it compounds when nested. This converter does not do em, pt, vw or %.
Use rem when you want spacing and type to scale with the userโs browser font-size. Use px when you truly need a fixed border or hairline.
Frequently asked questions
Why 16?
Browser default for html. Many design systems still use it.
Is rem the same as em?
No. rem is always the root. em is the parent.
pt to px?
Different page. 12pt is 16px only at the CSS 96dpi mapping.