Pixel to REM Converter

Convert pixels to REM units and back. Set your base font size, see a reference table of common values, and copy CSS with one click.

Usually set to the root font-size (default 16px in browsers)

Pixels

16.00px

REM

1.000rem

CSS Output

font-size: 1.000rem; /* 16.00px */

Common Values Reference

PixelsREMUsage
12px0.750remSmall text
14px0.875remBody text
16px1.000remBody text
18px1.125remSubheading
20px1.250remSubheading
24px1.500remHeading
32px2.000remHeading
48px3.000remLarge heading
64px4.000remLarge heading

Text Preview

Small (12px / 0.750rem)

The quick brown fox jumps over the lazy dog

Base (16px / 1.000rem)

The quick brown fox jumps over the lazy dog

Large (24px / 1.500rem)

The quick brown fox jumps over the lazy dog

XL (32px / 2.000rem)

The quick brown fox jumps over the lazy dog

Why REM Beats Pixels for Font Sizes

Browsers default the root font size to 16px. One rem equals the root font size, so 1rem = 16px out of the box, and 24px = 1.5rem, 12px = 0.75rem. The tool defaults to a 16px base; type a pixel value and see the rem instantly, or flip to rem-to-pixel mode if you're reading a stylesheet that uses rem. The conversion happens on every keystroke with no Calculate button.

REM matters because users can change their browser default from 16px to anything they like, usually for accessibility. If your CSS uses px everywhere, the user's setting is ignored and your text stays the size you hard-coded. If your CSS uses rem, every text size, padding, and spacing value scales with the user's preference. WCAG accessibility guidelines effectively require this; users with low vision who set their browser default to 24px depend on REM-based sites to render readably.

EM vs REM and the 62.5% Reset Trick

REM is always relative to the root html element. EM is relative to the parent element's font size, which means EM compounds: a 1.5em inside a 1.5em is 2.25 times the root. EM is useful for component-internal spacing where you want a button's padding to scale with its own font size. REM is what you want for global typography and layout because the maths is predictable: 1rem = root size, no matter how deeply nested.

The classic 'set html font-size to 62.5%' trick (which makes 1rem = 10px) lets you write 1.6rem instead of mentally converting 16px to 1rem. It works but it has a quiet cost: if a user has set their browser default above 16px for accessibility, your 62.5% multiplier propagates that change but at a smaller starting point. Modern guidance is to leave html font-size alone, write 1rem for body text, and use the Tailwind-style scale (0.875rem, 1rem, 1.125rem, 1.25rem, 1.5rem, 1.875rem, 2.25rem) for headings.

Common Pixel Values in REM (16px Base)

PixelsREMTailwind Equivalent
12px0.75remtext-xs
14px0.875remtext-sm
16px1remtext-base
18px1.125remtext-lg
20px1.25remtext-xl
24px1.5remtext-2xl
32px2remtext-4xl
48px3remtext-5xl

Frequently Asked Questions

Should I use REM, EM, or PX?

Use REM for typography, layout spacing, and anything that should scale with the user's browser preferences. Use EM for component-internal spacing that should scale with that component's font size (e.g. a button's padding). Use PX for borders, hairlines, and anything that genuinely should not scale (e.g. a 1px divider should stay 1px regardless of zoom).

Does REM work in older browsers?

REM has been supported in every browser shipped since 2012 (IE9+). It's safe to use unconditionally. The only place you'd reach for px today is for one-pixel borders and decorative graphics where you specifically don't want scaling, plus media queries (some teams still prefer px-based breakpoints for predictability).

What about media queries?

Media queries can use rem and the value is calculated against the user-agent default font size, not your html element's font size. So `@media (min-width: 48rem)` resolves to 768px on a default browser, and 1152px if the user has set their default to 24px. This is intentional: it means your breakpoints scale with user accessibility settings, often a feature, sometimes a surprise. Pick a side and stay consistent.

Why does my rem value have lots of decimals?

Pixel-to-rem conversion at non-multiples of 16 produces irrational fractions. 13px = 0.8125rem exactly, 15px = 0.9375rem. Most stylesheets round to three decimal places (0.813rem, 0.938rem). The visual difference between 0.8125rem and 0.813rem is sub-pixel and invisible. The tool shows three decimals, which is enough precision for any production use.

More tools β†’