Skip to content
MasterMath

PX to REM Converter

Pixels to rem with whatever root you use, plus the full type scale for headings.

In rem

—

In rem—
Scale chosen—
One step down—
If that number were rem—
Root used—
Scale upwards, in pixels—
The same scale in rem—

How this was worked out

    The formula

    rem = pixels ÷ root font size

    Where it comes from

    The rem is relative to the font size of the root element, which is 16 pixels by default in every browser: 24 px is 1.5 rem. Using it instead of pixels matters for a specific reason, not an aesthetic one: when someone raises the text size in their browser preferences — because they cannot see well, not on a whim — what changes is that root, and a design built in pixels ignores that preference entirely.

    How to work it out by hand

    1. Check the root font size; 16 px by default
    2. Divide the size in pixels by that root
    3. The result is the value in rem
    4. For the scale, multiply by the ratio at each level

    What is worth knowing

    A modular scale takes its names from musical intervals, and that is not a pretty coincidence: they are the same ratios. A major third is 1.25, a perfect fifth 1.5 and the golden ratio 1.618. The larger the ratio, the greater the contrast between body text and headings: 1.125 gives a subtle hierarchy that works in dense interfaces, while 1.5 gives a very marked one, more at home on a landing page. A word on the em, which gets confused with the rem: the em is relative to its parent element and therefore compounds when nested, so two levels of lists at 0.9 em end up at 0.81. The rem always looks at the root and has no such problem.

    Frequently asked questions

    How many pixels is 1 rem?

    Sixteen by default, because that is the root font size browsers ship with. Change that root and everything changes.

    How do I convert px to rem?

    Divide by 16: 24 px is 1.5 rem, 12 px is 0.75 rem and 32 px is 2 rem.

    Why use rem instead of pixels?

    Because it respects the text size the user has set in their browser. A pixel-based design ignores it, and that shuts out anyone who needs larger text.

    What is the difference between em and rem?

    The em is relative to its parent element and compounds when nested; the rem always looks at the root. That makes rem far more predictable.

    What is a type scale?

    A series where each size is the previous one times a fixed ratio. The names come from musical intervals because they are the same proportions.

    Which scale should I choose?

    1.125 or 1.2 for dense interfaces, where a subtle hierarchy works; 1.333 or 1.5 for content pages, where headings need to stand out.