🦉 UnitOwl

Pixels to Rem

1 Pixel (px) = 0.0625Rem (rem)

By KAMP Inc. / UnitOwl · Last reviewed:

Result
0.0625 rem
1 px = 0.0625 rem
Ad Slot (horizontal)

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

  1. Check the root font size (default is 16px in all major browsers).
  2. Divide the pixel value by the root font size to get rem.
  3. The formula is: rem = px / root-font-size.
  4. Common conversions at 16px base: 12px = 0.75rem, 14px = 0.875rem, 16px = 1rem, 20px = 1.25rem, 24px = 1.5rem.
  5. 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

A design mockup specifies 18px for subheadings. Convert to rem.
18 / 16 = 1.125rem. Use font-size: 1.125rem in your CSS.
The design calls for 4px border-radius. Should you use rem?
4 / 16 = 0.25rem. However, border-radius is often kept in px since it does not need to scale with font size.
A content container should be 960px wide. Convert to rem for a fluid layout.
960 / 16 = 60rem. At the default font size, this is 960px. If the user increases their font size, the container grows proportionally.
Paragraph spacing is 16px. What is that in rem?
16 / 16 = 1rem. Spacing equal to one line of body text.
A modal has 32px padding on all sides.
32 / 16 = 2rem. The padding scales with the root font size for consistent proportions.

Quick Reference

Pixel (px)Rem (rem)
10.0625
20.125
30.1875
50.3125
100.625
150.9375
201.25
251.5625
503.125
754.6875
1006.25
25015.625
50031.25
1,00062.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.
Ad Slot (auto)

Frequently Asked Questions

Is rem better than px for accessibility?
Yes. When users set a larger default font size in their browser (common for low-vision users), rem-based sizes scale up automatically. Pixel-based sizes do not. Using rem for font sizes and layout spacing is a WCAG accessibility best practice.
What is the "62.5% trick" for rem?
Setting html { font-size: 62.5%; } changes the root from 16px to 10px, making rem math trivial: 1.6rem = 16px, 2.4rem = 24px, 0.8rem = 8px. However, you must set body { font-size: 1.6rem; } to restore the expected 16px body text. This trick is popular but adds complexity.
Do all browsers support rem?
Yes. All modern browsers have supported rem since 2012. Internet Explorer 9+ supports rem. There is no browser compatibility reason to avoid rem in any current project.
Should I convert media query breakpoints to rem?
It is a best practice. Using rem-based breakpoints (e.g., @media (min-width: 48rem) instead of 768px) ensures that layouts respond correctly when users change their default font size. However, some CSS frameworks still use px breakpoints.
How many rem is 24px?
At the default 16px root, divide 24 by 16: 24px = 1.5rem. This is one of the most common spacing and heading conversions in design systems.
Quick Tip

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