How to convert px to rem
A rem ("root em") is a CSS unit relative to the font size of the root <html> element. Browsers default to 16px, so:
px = rem × root font size
At the default 16px root: 24px = 24 ÷ 16 = 1.5rem, and 0.875rem = 14px.
Why use rem instead of px?
- Accessibility: users who increase their browser's default font size get proportionally larger text and spacing when your sizes are in rem. Fixed pixel font sizes ignore that preference.
- Consistent scaling: change the root size once and the whole layout scales with it.
- Design systems: spacing and type scales such as 0.25rem, 0.5rem and 1rem are easy to keep consistent.
rem vs em
rem is always relative to the root font size. em is relative to the font size of the element's parent (or the element itself for properties other than font-size), so em values compound when nested. Use rem for most font sizes and spacing. Use em when something should scale with its own component's text, such as padding inside a button.
The 62.5% trick
Some developers set html { font-size: 62.5%; } so that 1rem = 10px, which makes the math easy (1.6rem = 16px). It works, but you must then set a readable body font size, and third-party components that assume 16px can come out too small. Many teams now keep the 16px default and use a converter like this one instead.
Common conversions at 16px
| px | rem | Typical use |
|---|---|---|
| 12px | 0.75rem | Captions, fine print |
| 14px | 0.875rem | Secondary text |
| 16px | 1rem | Body text |
| 20px | 1.25rem | Large text, small headings |
| 24px | 1.5rem | Headings |
| 32px | 2rem | Large headings |
| 48px | 3rem | Hero titles |
For print sizes and DPI, use pixels to inches. For color values, see HEX to RGB.
Frequently asked questions
How many pixels is 1rem?
16px by default in all major browsers, unless the root font size has been changed by CSS or by the user's browser settings.
How do I convert 14px to rem?
Divide by the root font size: 14 ÷ 16 = 0.875rem.
Should I use rem for media queries?
Using em or rem in media queries makes breakpoints respond to the user's font-size settings, which many developers prefer for accessibility.
Is rem supported in all browsers?
Yes. rem has been supported by all major browsers for many years.
Last updated December 2, 2026.