Unit-To-Unit Pixels conversion

PX to REM

1 CSS pixel = 0.0625 rem

Dividing by the root font size is the core of accessible CSS sizing: a layout in rem scales when a user raises their browser text size, while one in px does not. The default root is 16 px, and this converter lets you set your own.

Formula rem = px × 0.0625

=

Type in either field — the other updates on every keystroke. Need other units? Open the full pixels converter.

PX to REM — quick reference
CSS pixelRoot em
1 px0.0625 rem
2 px0.125 rem
3 px0.1875 rem
4 px0.25 rem
5 px0.3125 rem
10 px0.625 rem
15 px0.9375 rem
20 px1.25 rem
25 px1.5625 rem
50 px3.125 rem
100 px6.25 rem
500 px31.25 rem
1000 px62.5 rem
REM to PX — reverse
Root emCSS pixel
1 rem16 px
2 rem32 px
3 rem48 px
4 rem64 px
5 rem80 px
10 rem160 px
15 rem240 px
20 rem320 px
25 rem400 px
50 rem800 px
100 rem1600 px
500 rem8000 px
1000 rem16000 px

Worked examples

Common values
SituationFromTo
Small caption text12 px0.75 rem
Small text14 px0.875 rem
Default body text16 px1 rem
Large body text18 px1.125 rem
Subheading24 px1.5 rem
Page heading32 px2 rem

Mental-math shortcut

Divide by 16. For 24 px: 24 ÷ 16 = 1.5 rem.

Where this conversion comes up

Designers specify sizes in pixels, but accessibility guidance favours rem, which scales with the user's font-size setting. Common sizes: 14 px is 0.875 rem, 16 px is 1 rem, 18 px is 1.125 rem, and 32 px is 2 rem.

Common mistakes

The 16 px base is only the browser default. If a user or stylesheet changes the root font size, 1 rem changes with it. Setting html { font-size: 62.5% } makes 1 rem equal 10 px, but then body text needs resetting. Fixed px font sizes ignore user preferences.

Background

The CSS pixel is a reference unit defined as 1/96 inch, not a hardware pixel. The rem unit (root em) arrived with CSS3 to avoid the compounding that em units suffer in nested elements.

Learn more

Related guides: Digital and print layout units: px, rem, em, points and DPI

Frequently asked

How many rem are in a CSS pixel?
1 CSS pixel = 0.0625 rem. In the other direction, 1 rem = 16 CSS pixels.
What is a CSS pixel?
A CSS pixel is a reference unit of 1/96 inch, not a physical device pixel. Browsers scale it by the device pixel ratio, so one CSS pixel may cover four hardware pixels on a 2× display.
What is a rem?
A rem is the root element’s font size — 16 px in every browser by default, though stylesheets frequently override it. Sizing in rem lets a whole layout scale with the user’s chosen text size.
What is 1 rem in px?
16 px by default, because browsers set the root font size to 16 px.