EM ⇆ PX Converter
1 em equals the current element's font size. Adjust context for accurate results.
Convert em to pixels for any font size. Em is relative, so enter the context font size (the font size em is measured against) along with the em value. With the browser default of 16px, 1em = 16px.
How to convert EM to PX
px = em × context font size
The context depends on which CSS property you are setting:
- For
font-size, 1em is the parent element’s font size. - For everything else (padding, margin, width, line-height, border-radius), 1em is the element’s own font size.
Examples: 1.5em with a 16px context is 24px. 0.75em with a 20px context is 15px.
To convert back: em = px ÷ context font size. 18px in a 16px context is 1.125em.
EM to PX conversion table
| EM | 12px context | 14px context | 16px context | 18px context | 20px context |
|---|---|---|---|---|---|
| 0.25 em | 3 px | 3.5 px | 4 px | 4.5 px | 5 px |
| 0.5 em | 6 px | 7 px | 8 px | 9 px | 10 px |
| 0.75 em | 9 px | 10.5 px | 12 px | 13.5 px | 15 px |
| 0.875 em | 10.5 px | 12.25 px | 14 px | 15.75 px | 17.5 px |
| 1 em | 12 px | 14 px | 16 px | 18 px | 20 px |
| 1.125 em | 13.5 px | 15.75 px | 18 px | 20.25 px | 22.5 px |
| 1.25 em | 15 px | 17.5 px | 20 px | 22.5 px | 25 px |
| 1.5 em | 18 px | 21 px | 24 px | 27 px | 30 px |
| 1.75 em | 21 px | 24.5 px | 28 px | 31.5 px | 35 px |
| 2 em | 24 px | 28 px | 32 px | 36 px | 40 px |
| 2.5 em | 30 px | 35 px | 40 px | 45 px | 50 px |
| 3 em | 36 px | 42 px | 48 px | 54 px | 60 px |
| 4 em | 48 px | 56 px | 64 px | 72 px | 80 px |
Why EM values grow in nested elements
Em compounds. If a list is set to font-size: 1.2em and you nest another list inside it, the inner list is 1.2 × 1.2 = 1.44 times the base size. Three levels deep it is 1.728 times. That is why the same em value can produce different pixel sizes on the same page.
If you want a size that never compounds, use rem instead. Rem always refers to the root font size. See the EM to REM converter.
EM vs PX: when to use each
Use em when a value should scale with its own component, such as button padding that grows with the button text, or an icon set to width: 1em so it matches the text next to it.
Use px for fixed details that should not scale: 1px borders, hairline dividers and box-shadow offsets.
Use rem for global type sizes and spacing, so everything follows the user’s browser font setting without compounding.
Common EM to PX mistakes
- Assuming 1em is always 16px. It is 16px only when the context font size is 16px.
- Using the parent size for padding. Padding and margin in em use the element’s own font size, not the parent’s.
- Forgetting compounding. Multiply through each nested level before converting.
- Expecting media queries to use your html font size. Em in media queries uses the browser’s initial font size (usually 16px).
Frequently asked questions
How many pixels is 1em?
1em equals the context font size. With the browser default of 16px, 1em = 16px.
What is the formula to convert em to px?
px = em × context font size. For example, 2em in a 14px context is 28px.
What is the difference between em and rem?
Em is relative to the parent (for font-size) or the element itself (for other properties), so it compounds when nested. Rem is always relative to the root html font size and never compounds.
Is em better than px for accessibility?
Yes for text. Em and rem scale when a user increases the default font size in browser settings. Px does not.
Why does my em value look bigger than expected?
Most likely it is inside another element that also uses em, so the sizes multiply. Check the parent font sizes or switch to rem.
