PX to EM
& REM converter
Enter a value in any box to convert it. Change the root or parent font size to match your CSS, then copy the result.
EM here is for font-size, which uses the parent’s font size. REM uses the root font size.
Text preview
The quick brown fox jumps over the lazy dog.
24px = 1.5em = 1.5rem
The preview is limited to 96px. The conversion above uses the full value.
24px ÷ 16px parent = 1.5em
24px ÷ 16px root = 1.5rem
Common sizes
| Pixels | EM | REM |
|---|---|---|
| 8px | 0.5em | 0.5rem |
| 10px | 0.625em | 0.625rem |
| 12px | 0.75em | 0.75rem |
| 14px | 0.875em | 0.875rem |
| 16px | 1em | 1rem |
| 18px | 1.125em | 1.125rem |
| 20px | 1.25em | 1.25rem |
| 24px | 1.5em | 1.5rem |
| 28px | 1.75em | 1.75rem |
| 32px | 2em | 2rem |
| 36px | 2.25em | 2.25rem |
| 40px | 2.5em | 2.5rem |
| 48px | 3em | 3rem |
| 64px | 4em | 4rem |
| 72px | 4.5em | 4.5rem |
| 96px | 6em | 6rem |
How the units work
Pixels and REM
A CSS pixel is a reference unit, so it does not always equal one physical pixel on a screen. Browser zoom changes how large it looks.
REM is relative to the font size on the html element. With a 16px root, 1.5rem is 24px. Change the root to 20px and the same 1.5rem becomes 30px.
REM can keep text and spacing in proportion when the root size changes. A common browser default is 16px, but check the computed styles on the website you’re working on.
EM depends on where you use it
For font-size, EM uses the parent’s computed font size. A heading set to 1.5em inside a 20px parent is 30px, even if the root is still 16px.
For properties such as padding, EM uses the element’s own computed font size. A button with 20px text and padding: 0.5em has 10px of padding.
Nested text can grow at each level when you use EM for font sizes. REM keeps referring to the root. Use the two font-size settings above to compare them.
See MDN’s CSS values and units reference for more examples.
