Overview
CSS rem units are relative to the root font size, which is 16 px by default in browsers. This converts pixels to rem.
Enter the size in pixels and your base font size.
Worked examples
| Inputs | Result |
|---|---|
| Pixels (px)16Base Font Size (px)16 | 16px is equal to:1 rem (Base: 16px) |
Show 3 more examples
| Pixels (px)24Base Font Size (px)16 | 24px is equal to:1.5 rem (Base: 16px) |
| Pixels (px)14Base Font Size (px)16 | 14px is equal to:0.88 rem (Base: 16px) |
| Pixels (px)30Base Font Size (px)10 | 30px is equal to:3 rem (Base: 10px) |
Result (px) by pixels
With the calculator's starting values, the result is 16px is equal to:. The table shows how it changes with the pixels.
| Pixels (px) | Result (px) |
|---|---|
| 8 | 8px is equal to: |
| 10 | 10px is equal to: |
| 12 | 12px is equal to: |
| 14 | 14px is equal to: |
| 16starting value | 16px is equal to: |
| 18 | 18px is equal to: |
| 20 | 20px is equal to: |
| 22 | 22px is equal to: |
| 24 | 24px is equal to: |
Other inputs: Base Font Size: 16 px. Change them in the calculator above for your own numbers.
How it works
Rem = pixels ÷ base font size. Using rem makes layouts scale when users change their browser's text size, which helps accessibility.
The formula
Practical tips
- 16 px is 1 rem at the default 16 px base.
- 24 px is 1.5 rem, and 12 px is 0.75 rem.
- If your CSS sets html { font-size: 62.5% }, the base becomes 10 px, so 24 px is 2.4 rem.
Frequently asked questions
What's the difference between rem and em?
Rem is relative to the root element. Em is relative to the parent's font size, so it compounds.
Why use rem instead of px?
It respects users' font size settings.
How do I convert rem back to px?
Multiply by the base size.