PX to REM converter
Convert pixels to rem and rem to pixels instantly. Type in either field; the converter uses a 16px root font size by default, and you can change it to match your CSS.
24px = 1.5rem at a 16px root font size
How the conversion works
The rem unit stands for “root em”: one rem equals the font size of the root html element, also called the base font size. The formula is rem = pixels ÷ base font size, and the reverse is pixels = rem × base font size. Browsers default to a 16px base, so 16px = 1rem, 8px = 0.5rem and 80px = 5rem. If a visitor raises the default font size in their browser settings, every rem value grows with it, while px-based values stay fixed.
Pixel to rem conversion table (16px base font size)
| Pixels | REM |
|---|---|
| 1px | 0.0625rem |
| 2px | 0.125rem |
| 4px | 0.25rem |
| 8px | 0.5rem |
| 10px | 0.625rem |
| 12px | 0.75rem |
| 14px | 0.875rem |
| 16px | 1rem |
| 18px | 1.125rem |
| 20px | 1.25rem |
| 24px | 1.5rem |
| 28px | 1.75rem |
| 32px | 2rem |
| 36px | 2.25rem |
| 40px | 2.5rem |
| 48px | 3rem |
| 56px | 3.5rem |
| 64px | 4rem |
| 72px | 4.5rem |
| 80px | 5rem |
| 96px | 6rem |
| 128px | 8rem |
When to use rem, em and px
Use rem for font sizes, line heights and spacing so the whole layout scales when someone raises their default font size. Use emwhen a value should follow its own component’s text size, such as padding inside a button. Keep px for borders, shadows and other details that should stay crisp at any text size.
Check these values on any live website
Traceo is a free Chrome extension that shows the real CSS on any page: hover an element to read its colors in HEX and RGB, font sizes in px and rem, spacing, and contrast, then record and share UI bugs with console and network logs.
FAQ
How do you convert pixels to rem?
Divide the pixel value by the root font size. With the default browser root size of 16px, 24px ÷ 16 = 1.5rem and 80px ÷ 16 = 5rem. To convert rem to px, multiply: 1.5rem × 16 = 24px.
What is 1rem in px?
1rem equals the font size of the root html element. In most browsers that is 16px by default, so 1rem = 16px, unless the site or the user changes the root font size.
Is it better to use rem or px?
Use rem for font sizes and most spacing, because rem scales when a user increases their browser's default font size, which helps accessibility. Use px for things that should not scale with text, such as 1px borders and hairlines.
What is the difference between em and rem?
rem is relative to the root html font size, so it is the same everywhere on the page. em is relative to the font size of the current element, so it compounds when elements are nested. rem is easier to predict for layout and type scales.
Why does my site use a 10px root font size?
Some sites set html { font-size: 62.5% } so that 1rem = 10px and the math is easier (24px = 2.4rem). Change the root font size field in the converter to 10 to match those sites.