Formula
px = em × parent font size
At the browser default root size of 16px: 2.5em = 40px.
Resolving an em back to pixels requires knowing the computed font size of the element it sits on.
Converter
—
em to px conversion table
| Value | 10px root | 12px root | 14px root | 16px root | 18px root | 20px root |
|---|---|---|---|---|---|---|
| 0.125em | 1.25px | 1.5px | 1.75px | 2px | 2.25px | 2.5px |
| 0.25em | 2.5px | 3px | 3.5px | 4px | 4.5px | 5px |
| 0.375em | 3.75px | 4.5px | 5.25px | 6px | 6.75px | 7.5px |
| 0.5em | 5px | 6px | 7px | 8px | 9px | 10px |
| 0.625em | 6.25px | 7.5px | 8.75px | 10px | 11.25px | 12.5px |
| 0.75em | 7.5px | 9px | 10.5px | 12px | 13.5px | 15px |
| 0.875em | 8.75px | 10.5px | 12.25px | 14px | 15.75px | 17.5px |
| 1em | 10px | 12px | 14px | 16px | 18px | 20px |
| 1.125em | 11.25px | 13.5px | 15.75px | 18px | 20.25px | 22.5px |
| 1.25em | 12.5px | 15px | 17.5px | 20px | 22.5px | 25px |
| 1.375em | 13.75px | 16.5px | 19.25px | 22px | 24.75px | 27.5px |
| 1.5em | 15px | 18px | 21px | 24px | 27px | 30px |
| 1.75em | 17.5px | 21px | 24.5px | 28px | 31.5px | 35px |
| 2em | 20px | 24px | 28px | 32px | 36px | 40px |
| 2.25em | 22.5px | 27px | 31.5px | 36px | 40.5px | 45px |
| 2.5em | 25px | 30px | 35px | 40px | 45px | 50px |
| 2.75em | 27.5px | 33px | 38.5px | 44px | 49.5px | 55px |
| 3em | 30px | 36px | 42px | 48px | 54px | 60px |
| 3.5em | 35px | 42px | 49px | 56px | 63px | 70px |
| 4em | 40px | 48px | 56px | 64px | 72px | 80px |
| 4.5em | 45px | 54px | 63px | 72px | 81px | 90px |
| 5em | 50px | 60px | 70px | 80px | 90px | 100px |
| 6em | 60px | 72px | 84px | 96px | 108px | 120px |
| 7em | 70px | 84px | 98px | 112px | 126px | 140px |
| 8em | 80px | 96px | 112px | 128px | 144px | 160px |
| 9em | 90px | 108px | 126px | 144px | 162px | 180px |
| 10em | 100px | 120px | 140px | 160px | 180px | 200px |
| 12em | 120px | 144px | 168px | 192px | 216px | 240px |
| 16em | 160px | 192px | 224px | 256px | 288px | 320px |
| 20em | 200px | 240px | 280px | 320px | 360px | 400px |
| 24em | 240px | 288px | 336px | 384px | 432px | 480px |
Set it up once in CSS
/* 62.5 % makes 1rem = 10px, so 1.6rem = 16px.
Convenient, but it overrides the user's browser preference at the root —
prefer keeping the default and doing the maths. */
html { font-size: 100%; } /* 16px, respects user preference */
:root {
--step-0: 1rem; /* 16px */
--step-1: 1.25rem; /* 20px */
--step-2: 1.5rem; /* 24px */
--step-3: 2rem; /* 32px */
}
/* Fluid type without a converter, using clamp() */
h1 { font-size: clamp(1.75rem, 1.2rem + 2.5vw, 3rem); }
Questions
How do I convert em to px?
px = em × parent font size. With the browser default root font size of 16px, 2.5em = 40px.
What if the root font size is not 16px?
Then every value changes proportionally. The table above shows all six common root sizes side by side. Note that the root font size is whatever html computes to — if a user has increased their browser's default text size, the pixel result changes accordingly.
How do I convert px back to em?
Invert the formula, or use the px to em converter.
Other conversions
Common em values
Conversions follow the CSS Values and Units specification, in which 1in is defined as exactly 96px. Values are computed, not tabulated by hand.