Convert px to rem
The rem unit is relative to the root (html) element’s font size, so sizing
typography and spacing in rem keeps your layout scalable and respects the user’s
browser font-size preference for accessibility. This converter turns a pixel value
into the equivalent rem for a given root size, helping you migrate a design from
fixed pixels to relative units.
How it works
The conversion divides the pixel value by the root font size:
rem = px ÷ root font size (px)
px = rem × root font size (px)
Unlike em, the divisor is always the root font size, so rem values do not compound through nesting. The default root of 16px matches the browser’s standard.
Example
Convert 24px with the default 16px root:
- 24 ÷ 16 = 1.5rem
If the root were set to 10px (the “62.5%” technique), the same 24px would be 24 ÷ 10 = 2.4rem.
| Pixels | Root | Result |
|---|---|---|
| 24px | 16px | 1.5rem |
| 8px | 16px | 0.5rem |
| 24px | 10px | 2.4rem |
Enter your numbers and the result updates instantly, all in your browser.