Skip to content
EM ⇄ PX Converter

EM ⇆ PX Converter

1 em equals the current element's font size. Adjust context for accurate results.

With context 16px → 1 em = 16 px

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

EM12px context14px context16px context18px context20px context
0.25 em3 px3.5 px4 px4.5 px5 px
0.5 em6 px7 px8 px9 px10 px
0.75 em9 px10.5 px12 px13.5 px15 px
0.875 em10.5 px12.25 px14 px15.75 px17.5 px
1 em12 px14 px16 px18 px20 px
1.125 em13.5 px15.75 px18 px20.25 px22.5 px
1.25 em15 px17.5 px20 px22.5 px25 px
1.5 em18 px21 px24 px27 px30 px
1.75 em21 px24.5 px28 px31.5 px35 px
2 em24 px28 px32 px36 px40 px
2.5 em30 px35 px40 px45 px50 px
3 em36 px42 px48 px54 px60 px
4 em48 px56 px64 px72 px80 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.

Related CSS unit converters