EM to PX Converter

Convert between em and px. Set the base size to the font size of the parent element, then type a value in either box.

Base Font Size
Set the base font size in pixels (typically 16px for most browsers)
px
EM to PX
Enter em value to convert to pixels
PX to EM
Enter pixel value to convert to em
Common Conversions
Common em to px conversions based on your base size (16px)
EMPXCommon Use
0.25em4.0pxVery small spacing
0.5em8.0pxSmall spacing
0.75em12.0pxSmall text
1em16.0pxBase size
1.125em18.0pxH6 heading
1.25em20.0pxH5 heading
1.5em24.0pxH4 heading
1.75em28.0pxH3 heading
2em32.0pxH2 heading
2.5em40.0pxH1 heading
3em48.0pxLarge heading
4em64.0pxExtra large
About EM and PX
  • EM: Relative unit based on the parent element's font size
  • PX: Absolute unit representing screen pixels
  • Base size: The root font size (typically 16px in browsers)
  • Formula: em × base size = px | px ÷ base size = em
  • EM units are responsive and scale with user font size preferences

How to convert em and px

  1. Set the base font size. Use 16 for the browser default, or the computed font size of the parent element.
  2. Type an em value to get pixels, or a px value to get em. Typing in one box clears the other.
  3. Use the Common Conversions table for quick lookups at the current base size.

Example: a 24px heading inside an 18px article

With the default 16px base, 24px ÷ 16px = 1.5em. If the heading sits inside an article with font-size: 18px, the same 1.5em renders at 27px, because em on font-size is relative to the parent. To get exactly 24px there, set the base to 18: 24 ÷ 18 = 1.3333em.

.article { font-size: 18px; }
.article h2 { font-size: 1.5em; }    /* 27px */
.article h3 { font-size: 1.3333em; } /* 24px */

Frequently asked questions

How many pixels is 1em?

16px in all major browsers at default settings. It changes if the user picks a different default font size, or if a parent element sets its own font size.

Should I use em or rem?

rem is always relative to the root (html) font size, so 1.5rem is the same size everywhere on the page. em is relative to the parent and compounds when elements are nested. rem is the safer default for font sizes and layout spacing; em suits values that should scale with their own text, like padding on a button.

Can I use this for rem?

Yes. Set the base to your root font size (16 unless you changed the html font-size) and read the em result as rem.

Why doesn't 1em of padding match the parent's font size?

On properties other than font-size, em is relative to the element's own font size. A button with font-size: 14px and padding: 1em gets 14px of padding, whatever its parent's size is.

Why does my text get smaller in nested lists?

Each nested element multiplies by its parent. A ul with font-size: 0.9em inside another such ul ends up at 0.9 × 0.9 = 0.81 of the outer size. Switching to rem stops the compounding.