Skip to content
Menu

Pixels to EM

Pixels (px) to em (em) at any parent font size.

Result1.5em

Parent font size (px, for em)

Precision (significant figures)

Formula

em = px ÷ parent size

1 px = 0.0625 em with a 16 px parent font size

em = px ÷ parent font size. An em is relative to the font size of the element's parent, so 24 px is 1.5 em inside a 16 px parent but 2 em inside a 12 px one. Set the parent size and the converter does the rest.

Formula

em = px ÷ parent size

Worked example

  1. Start with 24 px.
  2. Divide by the parent font size (16 px): 24 ÷ 16 = 1.5 em.

Px to em chart

Values in em for common parent font sizes. em compounds when nested.

Pixels (px)14 px16 px18 px20 px
10.07142860.06250.05555560.05
20.1428570.1250.1111110.1
40.2857140.250.2222220.2
80.5714290.50.4444440.4
100.7142860.6250.5555560.5
120.8571430.750.6666670.6
1410.8750.7777780.7
161.1428610.8888890.8
181.285711.12510.9
201.428571.251.111111
241.714291.51.333331.2
2821.751.555561.4
322.2857121.777781.6
402.857142.52.222222
483.4285732.666672.4
644.5714343.555563.2

When you need this conversion

You have pixel values from a design and want them to scale with the text they sit next to. Button padding, the gap between an icon and its label, and the margin under a heading all look best when they grow with the font size. Writing them in em does exactly that.

How em is resolved

The browser takes the element’s computed font size and multiplies. For font-size itself, em refers to the parent font size; for every other property (padding, margin, width), it refers to the element’s own font size. That’s why this converter asks for a parent size: it’s the number that matters.

  • 8 px of padding on a 16 px button: 0.5em
  • 24 px heading inside 16 px body text: 1.5em
  • 12 px caption inside 16 px text: 0.75em

Common mistakes

Nesting em font sizes. Each level multiplies the one above it. Three nested elements at 1.2em end up at 1.728 times the base. If that’s not what you want, use rem for font sizes and keep em for spacing.

Assuming 1 em is always 16 px. It is only 16 px when the parent is 16 px. Inside a 20 px heading, 1 em is 20 px.

For sizes that shouldn’t compound, see pixels to rem. For the reverse, use em to pixels.

Questions

How many em is 16 px?

1 em when the parent font size is 16 px, which is the browser default for body text.

What is the difference between em and rem?

em is relative to the parent element's font size; rem is relative to the root (html) font size. em compounds when elements are nested, rem does not.

Why did my em sizes get bigger than expected?

Because em compounds. A list set to 1.2em inside another 1.2em list is 1.44 times the base size. Use rem for font sizes if you don't want that.

When should I use em?

For spacing that should scale with an element's own text, like button padding or icon size next to a label.

Sources

Last reviewed 2026-09-24. How we check values · Report a problem with this page

Further reading

  • px, rem and em in CSS: when to use each

    Three length units, three different reference points. What each one is measured against, how they behave when a reader changes their font size, and a simple rule for choosing.