PX to REM converter

Convert pixels to rem — and rem back to pixels — for any root font size, with a live quick-reference table. Everything runs in your browser; nothing you type is sent anywhere.

PX ↔ REM Typography Converter

Instantly convert between pixel sizes and proportional REM spacing units, based on a custom document root font size.

Calculator Settings

px
← →
rem

Quick Conversion Table

PixelsREM

How to use it

  1. Check the base size. Leave it at 16px unless your project overrides the root font size — 16px is every major browser's default.
  2. Type in either box. Enter a pixel value to get rem, or a rem value to get pixels. Both directions update instantly.
  3. Use the table for your scale. The quick-reference table recalculates for your base size, so you can build a whole type scale in one glance.

The maths is simply rem = px ÷ root font size. At the 16px default, that makes 16px = 1rem, 24px = 1.5rem and 8px = 0.5rem.

Why use rem instead of px?

Pixel values are absolute. When you set font-size: 16px, that text is locked at 16 pixels regardless of what the person reading it has asked for. Browsers let users raise their default text size — a setting that people with low vision genuinely rely on — and pixel-based text simply ignores it. That is not a stylistic preference; it is a failure of WCAG 2.1 success criterion 1.4.4 (Resize Text), which requires text to scale to 200% without loss of content or function.

Rem units solve this because they are relative to the root element's font size. If a visitor sets their browser default to 20px, every rem-based measurement on your page scales proportionally — your headings, body copy, spacing and layout all grow together, keeping the design's hierarchy intact instead of breaking it.

There is a second, practical benefit: consistency. Because rem always resolves against the same root value, 1.5rem is identical everywhere in your stylesheet. That makes a type scale predictable, and makes global adjustments trivial — change the root font size once and the entire interface rescales.

rem vs em vs px — which to use when

The three units each have a job, and most confusion comes from using one where another belongs:

UnitRelative toBest used for
remRoot font size (the <html> element)Font sizes, spacing, layout widths, media queries — anything that should scale with user preference
emThe current element's font sizePadding and margins inside a component that should scale with that component's own text — e.g. button padding
pxNothing — it is absoluteHairline borders, box-shadow offsets, and anything that genuinely should not scale (a 1px border should stay 1px)

The trap with em is compounding. Because it inherits from the parent's font size, nesting multiplies it: three levels of 1.2em gives you 1.2 × 1.2 × 1.2 ≈ 1.73× the base size, not 1.2×. That is why em is excellent for padding that should track its own button's text, and a poor default for typography.

The 62.5% trick — and why to think twice

A widely shared shortcut sets html { font-size: 62.5%; }, making 1rem equal 10px so the mental maths becomes easy (1.6rem = 16px). It works, and plenty of production sites use it. But it carries two costs worth knowing before you adopt it.

First, it overrides the visitor's chosen default rather than respecting it — someone who set their browser to 20px now gets 12.5px as their baseline. Second, any third-party component or CSS framework sized in rem will render 62.5% smaller than its author intended, because it assumed the standard root. Using a converter against the real 16px default sidesteps both issues entirely, which is why this tool defaults to 16.

Building a type scale in rem

Most design systems settle on a small set of steps rather than arbitrary values. A common, comfortable scale at a 16px root looks like: 0.75rem (12px) for fine print, 0.875rem (14px) for secondary text, 1rem (16px) for body copy, 1.25rem (20px) and 1.5rem (24px) for subheadings, then 2rem (32px) and 3rem (48px) for headings. Defining those as custom properties — --text-sm, --text-base, --text-lg — keeps your CSS readable and your spacing rhythm consistent.

For headings that should adapt to viewport width as well as user preference, combine rem with clamp(): font-size: clamp(1.5rem, 4vw, 3rem) gives a floor, a fluid middle and a ceiling, all still respecting the root size.

Frequently asked questions

What is 16px in rem?

At the default root font size of 16px, 16px equals exactly 1rem. The formula is rem = px ÷ root font size, so 24px is 1.5rem, 32px is 2rem and 8px is 0.5rem.

Should I use rem or px for font sizes?

Use rem. Pixel values ignore the visitor's browser font-size preference, so text set in px won't scale when someone increases their default text size — which fails WCAG success criterion 1.4.4. Rem scales with the root font size and respects that preference.

What is the difference between rem and em?

Rem is always relative to the root element's font size, so 1.5rem is the same size anywhere on the page. Em is relative to the current element's font size and compounds when nested — three nested elements at 1.2em each end up at roughly 1.73× the base size.

Should I change the root font size to 62.5%?

It makes 1rem equal 10px, which simplifies the maths, but it overrides the visitor's chosen browser default and makes third-party rem-based components render smaller than intended. Using a converter against the real 16px default avoids both problems.