Pixels to rem
Pixels to rem and back, at your real root size, not just the assumed 16.
24px ÷ 16 = 1.5rem (16px root size)
The same value in every unit
points
18pt
24px ÷ 1.3333 = 18pt (96 px per inch ÷ 72)
inches
0.25in
24px ÷ 96 = 0.25in (96 px per inch)
centimetres
0.635cm
24px ÷ 37.7953 = 0.635cm (96 px per inch ÷ 2.54)
millimetres
6.35mm
24px ÷ 3.7795 = 6.35mm (96 px per inch ÷ 25.4)
picas
1.5pc
24px ÷ 16 = 1.5pc (96 px per inch ÷ 6)
In short
Divide pixels by the root font size to get rem: at the browser default of 16px, 24px is 1.5rem and 14px is 0.875rem. To go back, multiply rem by the root size. If your site sets the root to 62.5%, the root is 10px and 24px becomes 2.4rem.
The formula
rem = px ÷ root
px = rem × root
root = 16px unless html { font-size } says otherwiseReference tables
Computed by the same code as the converter above.
| pixels | Root 16px (default) | Root 10px (62.5%) |
|---|---|---|
| 1px | 0.0625rem | 0.1rem |
| 2px | 0.125rem | 0.2rem |
| 4px | 0.25rem | 0.4rem |
| 8px | 0.5rem | 0.8rem |
| 10px | 0.625rem | 1rem |
| 12px | 0.75rem | 1.2rem |
| 14px | 0.875rem | 1.4rem |
| 16px | 1rem | 1.6rem |
| 18px | 1.125rem | 1.8rem |
| 20px | 1.25rem | 2rem |
| 24px | 1.5rem | 2.4rem |
| 28px | 1.75rem | 2.8rem |
| 32px | 2rem | 3.2rem |
| 40px | 2.5rem | 4rem |
| 48px | 3rem | 4.8rem |
| 64px | 4rem | 6.4rem |
| rem | Root 16px | Root 18px |
|---|---|---|
| 0.125rem | 2px | 2.25px |
| 0.25rem | 4px | 4.5px |
| 0.5rem | 8px | 9px |
| 0.75rem | 12px | 13.5px |
| 0.875rem | 14px | 15.75px |
| 1rem | 16px | 18px |
| 1.125rem | 18px | 20.25px |
| 1.25rem | 20px | 22.5px |
| 1.5rem | 24px | 27px |
| 2rem | 32px | 36px |
| 2.5rem | 40px | 45px |
| 3rem | 48px | 54px |
| 4rem | 64px | 72px |
The 16 is an assumption, and that is the point of rem
A rem is the root element's font size. Browsers set it to 16px, and visitors can change it in their settings: Evan Minto measured 3.08% of visitors to the Internet Archive with a default other than 16px. Type set in rem grows for them; type set in px does not. WCAG 1.4.4 asks that text can be resized to 200%, and rem is the cheapest way to honour the setting rather than fight it.
So a px-to-rem conversion is not really a change of value. 24px and 1.5rem are identical for the 97% on the default, and the rem version is correct for everyone else. That is why this tool asks for your root size instead of hard-coding 16: if your stylesheet sets html { font-size: 18px }, every conversion should use 18.
The 62.5% pattern sets the root to 62.5% of the visitor's default, which is 10px at 16, so that 2.4rem reads as 24px. It still scales with the setting, because it is a percentage. Its cost is that every element inherits a 10px base unless the body resets it, and a missed reset ships 10px text.
Worked examples
Real sizes, with the sums.
Converting a spacing scale
You give it
4, 8, 12, 16, 24, 32 and 48px at a 16px root.
You get
0.25, 0.5, 0.75, 1, 1.5, 2 and 3rem. Every step lands on a short decimal because each is a multiple of 4px.
A site with html { font-size: 62.5% }
You give it
14px body text.
You get
14 ÷ 10 = 1.4rem. At the default 16px root the same 14px would be 0.875rem; using the wrong root gives 22.4px (60% too big) one way and 8.75px (37.5% too small) the other.
Questions people ask
Straight answers. Each one links directly: copy the address after opening it.
How many pixels is 1rem?
As many as the root font size: 16px by default in every major browser, or more for a visitor who has increased their default text size.
Should I use rem or px for font sizes?
Rem, for text. It follows the visitor's font-size preference and px does not. Borders and hairlines are fine in px, because they should stay thin when text grows.
What is the difference between rem and em?
Rem is always relative to the root, so it means the same thing everywhere on the page. Em is relative to the element's own font size, so it compounds when nested. See the px to em converter for that.
Other unit conversions
Pixel converter
Every unit at once, for CSS, print or this screen.
Pixels to inches
Pixels to inches and back, for CSS, for print, or as measured on your screen.
Pixels to centimetres
Pixels to centimetres and millimetres, and back, with A-series paper in whole pixels.
Pixels to points
Pixels to points and back: move a type size from a design file to a document.
Pixels to em
Pixels to em and back for a given parent size, with the compounding shown.