AyeCalc
All tools
Developer units

PX to REM Converter

Convert any pixel value to rem for scalable CSS sizing. The calculator uses a 16px root font size by default and lets you match the actual root size used by your project.

Instant resultAdjustable assumptionsNo data sent
Instant conversion

px rem

Runs in your browser
root ems1rem

Result rounded to a maximum of six decimal places.

Conversion rulerem = px ÷ root font size

At a 16px root: rem = px ÷ 16.

01
Method

How to convert pixels to root ems

Divide the pixel value by the root element's font size. With the common 16px browser default, 16px equals 1rem and 24px equals 1.5rem.

Formularem = px ÷ root font size

At a 16px root: rem = px ÷ 16.

02
Worked example

Convert 24 px to rem

Apply the conversion rule to 24 pixels. Using the default settings, the result is 1.5 rem.

24 px1.5 rem

Default context: root font size 16px.

03
Quick reference

px to rem conversion table

These pre-calculated values use the same formula and default settings as the converter above.

Common pixels to root ems conversions
pixels (px)root ems (rem)
1 px0.0625 rem
2 px0.125 rem
4 px0.25 rem
8 px0.5 rem
10 px0.625 rem
12 px0.75 rem
14 px0.875 rem
16 px1 rem
18 px1.125 rem
20 px1.25 rem
24 px1.5 rem
32 px2 rem
48 px3 rem
64 px4 rem
80 px5 rem
96 px6 rem
04
Practical use

Code and calculation snippets

Reuse the same conversion in a stylesheet or application. Keep contextual font sizes configurable when working with relative CSS units.

CSS
html { font-size: 16px; }
.heading { font-size: 1.5rem; } /* 24px */
JavaScript
const rem = pixels / rootFontSize;
Sass
@use "sass:math";
@function rem($px, $base: 16) {
  @return math.div($px, $base) * 1rem;
}
05
Interpretation

Using the result accurately

REM units are useful when spacing and typography should scale from one document-level setting. Confirm the computed font size of the HTML element before converting a design system.

Important limitation

The result changes when the root font size changes. Browser zoom does not rewrite the CSS conversion ratio, but user font preferences and project styles can affect the computed root size.

Reference: W3C CSS Values and Units: font-relative lengths.

Common questions

PX to REM Converter FAQ

Short answers about the formula, assumptions, and displayed precision.

How do I convert pixels to root ems?

Divide the pixel value by the root element's font size. With the common 16px browser default, 16px equals 1rem and 24px equals 1.5rem. For example, 24 px converts to 1.5 rem using the default settings.

What formula does this px-to-rem converter use?

rem = px ÷ root font size. At a 16px root: rem = px ÷ 16.

What assumptions does the calculator make?

The calculator starts with 16px for the root font size. You can change it to match your CSS.

How many decimal places should I use?

The calculator shows up to six decimal places and removes unnecessary trailing zeros. Keep more precision for further calculations, then round the final value to suit your measurement or design system.