CSS & Design

px to rem Converter — 16px = 1rem by Default

At the default browser font size, 16px equals 1rem. This converter translates pixel values to rem units (and back) for scalable, accessible typography. You can set a custom base font size if your project uses a different root. All calculations run locally in your browser.

Input (px)0 values
Output (rem)0 values
pxrem
4px0.25rem
8px0.5rem
12px0.75rem
14px0.875rem
16px1rem
18px1.125rem
20px1.25rem
24px1.5rem
28px1.75rem
32px2rem
36px2.25rem
40px2.5rem
48px3rem
56px3.5rem
64px4rem
80px5rem
96px6rem

What is rem?

The rem unit (root em) equals the computed font-size of the root element (<html>). By default, browsers set this to 16px. Unlike px, rem scales when users change their browser font size, making it ideal for accessible typography. See: CSS Values Level 4.

Why Use This Tool

  • Responsive typography — Use rem for font sizes that scale with user preferences.
  • Accessible design — Let users increase text size without breaking layouts.
  • Design-to-code conversion — Convert Figma/Sketch pixel specs to rem values for CSS.
  • Consistent spacing — Use rem for margins and padding that scale together.
  • Component libraries — Build scalable components with relative units. Minify CSS →

Tips

  • 16px = 1rem at the default browser font size.
  • For easy math: 24px = 1.5rem, 32px = 2rem, 12px = 0.75rem.
  • Use px for thin borders and shadows; use rem for text and spacing.
  • The 62.5% base (10px) simplifies math but may confuse component libraries.
  • em compounds in nested elements; rem does not.

How to Use the px to rem Converter

1

Enter a pixel value

Type a pixel value (like 24) in the input field to convert to rem.

2

Set the base font size (optional)

The default is 16px. Change it if your root font-size is different.

3

Read the result

The rem equivalent appears instantly. For 24px at base 16px: 1.5rem.

4

Use the reference table

Check common conversions in the table below for quick reference.

Worked Examples

Standard conversion

Input
16px
→
Output
1rem

At the default 16px base.

Heading size

Input
24px
→
Output
1.5rem

Small text

Input
12px
→
Output
0.75rem

Large heading

Input
48px
→
Output
3rem

With 10px base

Input
20px (base: 10px)
→
Output
2rem

Some projects use 62.5% (10px) base for easier math.

px vs rem vs em

Featurepxrem
Scales with user settingsNoYes
Relative toScreen pixelRoot font-size
AccessibleLimitedYes
PredictableYesYes (if root is known)
Use caseBorders, shadowsTypography, spacing

Frequently Asked Questions

What is 1rem in pixels?

At the default browser setting, 1rem equals 16px. If the root font-size is changed (e.g., html { font-size: 10px }), then 1rem equals that value.

How do I convert px to rem?

Divide the pixel value by the root font-size. For example: 24px ÷ 16px = 1.5rem. This tool does the calculation for you.

Why use rem instead of px?

rem scales when users change their browser font size setting, improving accessibility. px is fixed and does not respect user preferences.

Should I use rem for everything?

Use rem for typography and spacing. Use px for things that should not scale, like thin borders (1px), box shadows, or very small fixed elements.

What is the 62.5% trick?

Setting html { font-size: 62.5% } makes 1rem = 10px, so conversions are easier (20px = 2rem). However, this can confuse team members and third-party components.

What is the difference between rem and em?

rem is relative to the root (<html>) font-size. em is relative to the parent element's font-size. rem is more predictable because it does not compound.