px to rem Converter — 16px = 1rem by Default
At the default browser font size, 16px equals 1rem. This converter translates pixel values to rem units (and back) for scalable, accessible typography. You can set a custom base font size if your project uses a different root. All calculations run locally in your browser.
| px | rem |
|---|---|
| 4px | 0.25rem |
| 8px | 0.5rem |
| 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 |
| 80px | 5rem |
| 96px | 6rem |
What is rem?
The rem unit (root em) equals the computed font-size of the root element (<html>). By default, browsers set this to 16px. Unlike px, rem scales when users change their browser font size, making it ideal for accessible typography. See: CSS Values Level 4.
Why Use This Tool
- Responsive typography — Use rem for font sizes that scale with user preferences.
- Accessible design — Let users increase text size without breaking layouts.
- Design-to-code conversion — Convert Figma/Sketch pixel specs to rem values for CSS.
- Consistent spacing — Use rem for margins and padding that scale together.
- Component libraries — Build scalable components with relative units. Minify CSS →
Tips
- 16px = 1rem at the default browser font size.
- For easy math: 24px = 1.5rem, 32px = 2rem, 12px = 0.75rem.
- Use px for thin borders and shadows; use rem for text and spacing.
- The 62.5% base (10px) simplifies math but may confuse component libraries.
- em compounds in nested elements; rem does not.
How to Use the px to rem Converter
Enter a pixel value
Type a pixel value (like 24) in the input field to convert to rem.
Set the base font size (optional)
The default is 16px. Change it if your root font-size is different.
Read the result
The rem equivalent appears instantly. For 24px at base 16px: 1.5rem.
Use the reference table
Check common conversions in the table below for quick reference.
Worked Examples
Standard conversion
16px
1rem
At the default 16px base.
Heading size
24px
1.5rem
Small text
12px
0.75rem
Large heading
48px
3rem
With 10px base
20px (base: 10px)
2rem
Some projects use 62.5% (10px) base for easier math.
px vs rem vs em
| Feature | px | rem |
|---|---|---|
| Scales with user settings | No | Yes |
| Relative to | Screen pixel | Root font-size |
| Accessible | Limited | Yes |
| Predictable | Yes | Yes (if root is known) |
| Use case | Borders, shadows | Typography, spacing |
Frequently Asked Questions
What is 1rem in pixels?
At the default browser setting, 1rem equals 16px. If the root font-size is changed (e.g., html { font-size: 10px }), then 1rem equals that value.
How do I convert px to rem?
Divide the pixel value by the root font-size. For example: 24px ÷ 16px = 1.5rem. This tool does the calculation for you.
Why use rem instead of px?
rem scales when users change their browser font size setting, improving accessibility. px is fixed and does not respect user preferences.
Should I use rem for everything?
Use rem for typography and spacing. Use px for things that should not scale, like thin borders (1px), box shadows, or very small fixed elements.
What is the 62.5% trick?
Setting html { font-size: 62.5% } makes 1rem = 10px, so conversions are easier (20px = 2rem). However, this can confuse team members and third-party components.
What is the difference between rem and em?
rem is relative to the root (<html>) font-size. em is relative to the parent element's font-size. rem is more predictable because it does not compound.