Code tool

PX REM EM Converter

Add named scenarios with explicit font sizes. Convert any source unit to all three units and inspect inverse coefficients and a scaled variant.

In-browser processingNo account requiredPrivacy details ↗

1 rem = root font size in px. 1 em = supplied context font size in px. For font-size declarations em uses the parent font size; for most other lengths it uses the element font size. Supply that relevant size explicitly. No browser default is assumed; CSS pixels are not physical screen pixels.

Decimal input is parsed as an exact BigInt fraction. All products, divisions, inverse coefficients and scaled variants retain exact fractions; only the labelled decimal display is rounded to 12 places. Scaling changes the source length, keeping the entered font sizes fixed.

Inputs and exports stay in this browser.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter a decimal length and choose px, rem or em.
  2. Enter the root font size and the relevant context font size in px, then a scaling factor.
  3. Calculate every scenario; copy or download the full report with raw inputs and exact fractions.

Font context and exact arithmetic

1 rem = root font size in px. 1 em = supplied context font size in px. For font-size declarations em uses the parent font size; for most other lengths it uses the element font size. Supply that relevant size explicitly. No browser default is assumed; CSS pixels are not physical screen pixels.

Exact conversion report

Decimal input is parsed as an exact BigInt fraction. All products, divisions, inverse coefficients and scaled variants retain exact fractions; only the labelled decimal display is rounded to 12 places. Scaling changes the source length, keeping the entered font sizes fixed.

GOOD TO KNOW

Common questions

Does changing the root size also change the context size?

Not automatically here. Each scenario declares both sizes independently. Add another scenario with the actual new root and context sizes to compare layouts.