Pixels to Rem
1 Pixel (px) = 0.0625Rem (rem)
By KAMP Inc. / UnitOwl · Last reviewed:
How to Convert Pixels to Rem?
To convert pixels to rem, divide the pixel value by the root element's font size (16px by default). One rem equals the font size of the html element. With the standard 16px root, 1rem = 16px, 0.875rem = 14px, and 1.25rem = 20px. Rem units are the modern best practice for accessible, responsive web design. Unlike em, rem does not compound — 1.5rem always equals 24px (at a 16px root) regardless of how deeply nested the element is. This predictability makes rem the preferred unit for font sizes, spacing, and layout dimensions in CSS. Converting pixel-based designs to rem is one of the most common tasks in front-end development, and every web developer should be fluent in this conversion. It is also central to design tokens and component libraries, where teams want one root setting to scale an entire interface consistently. A solid px-to-rem workflow makes it easier to support accessibility preferences, keep spacing systems coherent, and avoid brittle magic numbers spread across a stylesheet. That same consistency is why teams often define their spacing and type scales in rem from the start.
How to Convert Pixel to Rem
- Check the root font size (default is 16px in all major browsers).
- Divide the pixel value by the root font size to get rem.
- The formula is: rem = px / root-font-size.
- Common conversions at 16px base: 12px = 0.75rem, 14px = 0.875rem, 16px = 1rem, 20px = 1.25rem, 24px = 1.5rem.
- If your root is set to something other than 16px (e.g., 10px via the 62.5% trick), use that value as the divisor.
Real-World Examples
Quick Reference
| Pixel (px) | Rem (rem) |
|---|---|
| 1 | 0.0625 |
| 2 | 0.125 |
| 3 | 0.1875 |
| 5 | 0.3125 |
| 10 | 0.625 |
| 15 | 0.9375 |
| 20 | 1.25 |
| 25 | 1.5625 |
| 50 | 3.125 |
| 75 | 4.6875 |
| 100 | 6.25 |
| 250 | 15.625 |
| 500 | 31.25 |
| 1,000 | 62.5 |
History of Pixel and Rem
The rem unit was introduced in the CSS3 specification to address the compounding problem of em units. Before rem, developers had to carefully track the font-size cascade to calculate em values correctly — a 1.2em paragraph inside a 1.5em section inside a 1.2em article resulted in a font size of 1.2 x 1.5 x 1.2 = 2.16 times the root. Rem bypasses this entirely by always referencing the root. Browser support for rem became universal around 2012-2013, and it quickly became the standard unit for modern CSS frameworks. Tailwind CSS, Bootstrap (v4+), and most design systems now use rem as their primary sizing unit.
Common Mistakes to Avoid
- Using rem where px is more appropriate. Borders, box-shadows, and decorative elements that should remain a fixed size regardless of font size are better specified in px. Not everything should scale.
- Forgetting that rem is root-relative, not parent-relative. If a parent element has font-size: 20px, rem still references the root (16px), not the parent. This is the key difference from em.
- Not accounting for the 62.5% trick. Some projects set html { font-size: 62.5%; } to make 1rem = 10px. In these projects, 16px = 1.6rem, not 1rem. Always check the project root font size before converting.
- Assuming rem stays visually fixed when users raise their browser default font size. Rem is supposed to scale with that preference. If a layout breaks, the issue is usually the layout, not the rem unit.
Frequently Asked Questions
Is rem better than px for accessibility?
What is the "62.5% trick" for rem?
Do all browsers support rem?
Should I convert media query breakpoints to rem?
How many rem is 24px?
Note: Em and rem conversions in this tool assume the standard 16px browser default root font size. If your project uses a different root font size, adjust calculations accordingly. The most common alternative is the 62.5% trick (10px root), where you divide pixel values by 10 instead of 16.
Sources & References
- NIST — Units and Conversion Factors — Official unit conversion factors from the National Institute of Standards and Technology.
- BIPM — The International System of Units (SI) — International SI unit definitions from the International Bureau of Weights and Measures.