Skip to content
Menu

Pixels to REM

Pixels (px) to rem (rem) at any root font size. Browsers default to 16 px.

Result1.5rem

Root font size (px, for rem)

Precision (significant figures)

Formula

rem = px ÷ root size

1 px = 0.0625 rem with a 16 px root font size

rem = px ÷ root font size. Every browser uses a 16 px root by default, so 16 px = 1 rem, 24 px = 1.5 rem and 14 px = 0.875 rem. If your CSS sets a different size on html, enter it as the root font size and the result follows.

Formula

rem = px ÷ root size

Worked example

  1. Start with 24 px.
  2. Divide by the root font size (16 px): 24 ÷ 16 = 1.5 rem.

Px to rem chart

Values in rem for common root font sizes. Browsers default to 16 px.

Pixels (px)14 px16 px18 px20 px
10.07142860.06250.05555560.05
20.1428570.1250.1111110.1
40.2857140.250.2222220.2
80.5714290.50.4444440.4
100.7142860.6250.5555560.5
120.8571430.750.6666670.6
1410.8750.7777780.7
161.1428610.8888890.8
181.285711.12510.9
201.428571.251.111111
241.714291.51.333331.2
2821.751.555561.4
322.2857121.777781.6
402.857142.52.222222
483.4285732.666672.4
644.5714343.555563.2

When you need this conversion

Design files hand you sizes in pixels: a 24 px heading, 14 px captions, 32 px spacing. Modern CSS writes them in rem so the whole interface scales with the reader’s font setting. Converting keeps your implementation pixel-accurate at the default size and accessible at every other size.

Choosing the root size

  • 16 px is the default in Chrome, Safari, Firefox and Edge. If your CSS never sets a font size on html, use this.
  • 10 px if you use the 62.5% trick. The math gets easy (divide by 10), but remember to set a readable body size, for example body { font-size: 1.6rem }.
  • Your own base if you set html { font-size: 18px } or similar. A fixed px value on html stops user settings from applying, so prefer a percentage.

Useful values at a 16 px root

  • 12 px = 0.75 rem, 14 px = 0.875 rem, 18 px = 1.125 rem
  • 20 px = 1.25 rem, 24 px = 1.5 rem, 32 px = 2 rem, 48 px = 3 rem

Common mistakes

Setting a fixed px size on html. html { font-size: 16px } looks harmless but overrides the user’s browser preference. Use 100% (or leave it alone) instead.

Using rem for borders. A 1 px border becomes 0.0625 rem and can round to 0 or 2 device pixels at some zoom levels. Hairlines are one of the few places px is still the better choice.

Going the other way? Use the rem to pixels converter.

Questions

How many rem is 16 px?

1 rem with the default 16 px root. With a 10 px root (html { font-size: 62.5% }) it would be 1.6 rem.

Why use rem instead of px?

rem scales with the user's browser font-size setting. People who set a larger default font get larger text and spacing everywhere you used rem; px ignores that preference.

What is the 62.5% trick?

Setting html { font-size: 62.5% } makes the root 10 px (62.5% of 16), so 24 px becomes a tidy 2.4 rem. It still respects user settings because it is a percentage.

What's the difference between rem and em?

rem is relative to the root (html) font size, so it is the same everywhere on the page. em is relative to the parent element's font size, so it compounds when elements are nested.

Sources

Last reviewed 2026-09-24. How we check values · Report a problem with this page

Further reading

  • px, rem and em in CSS: when to use each

    Three length units, three different reference points. What each one is measured against, how they behave when a reader changes their font size, and a simple rule for choosing.