Skip to content
1440px

px to em

em = px ÷ parent font size — with a live converter and the full table.

Formula
em = px ÷ parent font size

At the browser default root size of 16px: 16px = 1em.

Identical arithmetic to rem, but the divisor is the parent element's font size rather than the root — so em compounds when you nest it.

Converter

px to em conversion table

px to em at each common root font size
Value10px root12px root14px root16px root18px root20px root
1px0.1em0.0833em0.0714em0.0625em0.0556em0.05em
2px0.2em0.1667em0.1429em0.125em0.1111em0.1em
4px0.4em0.3333em0.2857em0.25em0.2222em0.2em
6px0.6em0.5em0.4286em0.375em0.3333em0.3em
8px0.8em0.6667em0.5714em0.5em0.4444em0.4em
10px1em0.8333em0.7143em0.625em0.5556em0.5em
12px1.2em1em0.8571em0.75em0.6667em0.6em
14px1.4em1.1667em1em0.875em0.7778em0.7em
16px1.6em1.3333em1.1429em1em0.8889em0.8em
18px1.8em1.5em1.2857em1.125em1em0.9em
20px2em1.6667em1.4286em1.25em1.1111em1em
22px2.2em1.8333em1.5714em1.375em1.2222em1.1em
24px2.4em2em1.7143em1.5em1.3333em1.2em
28px2.8em2.3333em2em1.75em1.5556em1.4em
32px3.2em2.6667em2.2857em2em1.7778em1.6em
36px3.6em3em2.5714em2.25em2em1.8em
40px4em3.3333em2.8571em2.5em2.2222em2em
44px4.4em3.6667em3.1429em2.75em2.4444em2.2em
48px4.8em4em3.4286em3em2.6667em2.4em
56px5.6em4.6667em4em3.5em3.1111em2.8em
64px6.4em5.3333em4.5714em4em3.5556em3.2em
72px7.2em6em5.1429em4.5em4em3.6em
80px8em6.6667em5.7143em5em4.4444em4em
96px9.6em8em6.8571em6em5.3333em4.8em
112px11.2em9.3333em8em7em6.2222em5.6em
128px12.8em10.6667em9.1429em8em7.1111em6.4em
144px14.4em12em10.2857em9em8em7.2em
160px16em13.3333em11.4286em10em8.8889em8em
192px19.2em16em13.7143em12em10.6667em9.6em
224px22.4em18.6667em16em14em12.4444em11.2em
256px25.6em21.3333em18.2857em16em14.2222em12.8em
320px32em26.6667em22.8571em20em17.7778em16em
384px38.4em32em27.4286em24em21.3333em19.2em
448px44.8em37.3333em32em28em24.8889em22.4em
512px51.2em42.6667em36.5714em32em28.4444em25.6em

Set it up once in CSS

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 px to em?

em = px ÷ parent font size. With the browser default root font size of 16px, 16px = 1em.

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 em back to px?

Invert the formula, or use the em to px converter.

Other conversions

Common px values

Conversions follow the CSS Values and Units specification, in which 1in is defined as exactly 96px. Values are computed, not tabulated by hand.