PX to REM Converter

Convert pixels to rem or em against any root font size.

Common CSS values:

Why the root font size is the whole point

A rem is simply a multiple of the root element's font size. At the browser default of 16px,1.5rem resolves to 24px — which makes the conversion look like a pointless division until you remember that the root is not fixed. A reader who sets their browser's default text size to 20px shifts every rem on the page with it, and the layout grows to match. A page built in pixels ignores that setting completely.

That is also why rem beats em for most work. An em is relative to its parent's font size, so it compounds: nest three elements at 0.9em and you are at 0.73 of where you started, which is rarely what anyone intended. Reach for em only when you actively want a value to track its immediate context — padding inside a button that should grow with the button's own label, for instance.

You will still see the advice to set the root to 62.5% so that 1rem equals 10px and the mental arithmetic disappears. It works, but it does so by overriding the reader's preference — which is the one thing rem exists to preserve. Leave the root alone and let the table above do the arithmetic.

PX to REM conversion table (16px root)

Every value below assumes the browser default root font size of 16px, so1rem = 16px. If your root is different, use the converter above — the ratio changes with it.

1px0.0625rem
2px0.125rem
3px0.1875rem
4px0.25rem
5px0.3125rem
6px0.375rem
7px0.4375rem
8px0.5rem
9px0.5625rem
10px0.625rem
11px0.6875rem
12px0.75rem
13px0.8125rem
14px0.875rem
15px0.9375rem
16px1rem
17px1.0625rem
18px1.125rem
19px1.1875rem
20px1.25rem
21px1.3125rem
22px1.375rem
23px1.4375rem
24px1.5rem
25px1.5625rem
26px1.625rem
27px1.6875rem
28px1.75rem
29px1.8125rem
30px1.875rem
31px1.9375rem
32px2rem
36px2.25rem
40px2.5rem
44px2.75rem
48px3rem
56px3.5rem
64px4rem
72px4.5rem
80px5rem
96px6rem
128px8rem

REM to PX conversion table (16px root)

0.125rem2px
0.25rem4px
0.375rem6px
0.5rem8px
0.625rem10px
0.75rem12px
0.875rem14px
1rem16px
1.125rem18px
1.25rem20px
1.5rem24px
1.75rem28px
2rem32px
2.5rem40px
3rem48px
4rem64px
5rem80px
6rem96px

Doing it in your head

At a 16px root, halving works cleanly: 16px is 1rem, 8px is 0.5rem, 4px is 0.25rem and 2px is 0.125rem. Most sizes in a typical scale are sums of those four, so 24px is 16 + 8 = 1.5rem and 12px is 8 + 4 = 0.75rem. The awkward ones are multiples of 3 and 5 — 14px is 0.875rem and 18px is 1.125rem — which is exactly what the table is for.

Frequently asked questions

How do I convert px to rem?

Divide the pixel value by the root font size. With the default root of 16px, 24px ÷ 16 = 1.5rem. To go the other way, multiply: 1.5rem × 16 = 24px.

What is the difference between rem and em?

rem is always relative to the root element’s font size, so it is predictable anywhere in the document. em is relative to the font size of the element’s own parent, which compounds through nesting — three levels of 0.9em leaves you at about 0.73 of the original, not 0.9.

Why use rem instead of px at all?

Because a reader who raises their browser’s default font size expects the page to respond. Lengths in px ignore that setting entirely; lengths in rem scale with it. It is one of the cheapest accessibility wins available.

Should I change the root font size from 16px?

Usually not. 16px is the browser default and the number every reader’s accessibility setting is expressed against. The old trick of setting the root to 62.5% to make 1rem equal 10px does make the arithmetic easier, but it overrides the reader’s preference, which is the thing rem exists to respect.

Do rem units work for anything besides font size?

Yes — padding, margin, width, border-radius, and media query breakpoints all accept rem. Using it for spacing as well as type means the whole layout scales together rather than text growing inside fixed-size boxes.