Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
PX to EM Converter

PX to EM Converter

Convert pixel values to em units based on the parent element's font size.

PX to EM Converter

This tool converts pixel (px) values into em units for CSS. Unlike rem, the em unit is relative to the font-size of the element's own (or nearest) parent, so the conversion always depends on the context you place it in. Set the base font size to match your real parent element, type a pixel value, and the em equivalent appears instantly — ready to copy into your stylesheet.

With the default 16px base, 16px = 1em. Change the base font size in the settings to match the parent context where the value will actually be used.

When to Reach for EM

Component-Level Sizing

Build buttons, badges, and cards whose padding and spacing scale together when you change the component's font-size.

Self-Scaling Spacing

Tie margins and padding to local text size so a single font-size change resizes the whole block proportionally.

Typographic Rhythm

Express line-height, letter-spacing, and indentation relative to the current font for consistent vertical rhythm.

How to Convert PX to EM

1

Set the Parent Font Size

Enter the font-size of the parent element in the Base Font Size field (default 16px). This is the value every em result is calculated against.

2

Enter a Pixel Value

Make sure the px unit tab is selected, then type the pixel value you want to convert. The em equivalent updates as you type.

3

Read the Result

The em value appears instantly in the results panel, alongside the rem and px equivalents for quick comparison. Adjust the decimal-places setting for the precision you need.

4

Copy Into Your CSS

Click the copy button next to the em result and paste it straight into your stylesheet — no manual division required.

The formula: em = px ÷ parent font-size. For example, 24px ÷ 16px = 1.5em.

EM vs REM: Know the Difference

Both are relative units, but they reference different things. The key distinction is compounding: em values stack when elements are nested, while rem always points back to the root.

EM

Relative to the parent

  • Based on the nearest parent's font-size
  • Compounds across nested elements
  • Great for self-contained components
  • Context changes the computed value
REM

Relative to the root

  • Based on the root (html) font-size
  • Never compounds — always predictable
  • Great for global layout and typography
  • Same value everywhere on the page
Watch out for compounding. If a parent is set to 1.25em and a child also uses 1.25em, the child renders at 1.25 × 1.25 = ~1.56× the grandparent's size. Always confirm which parent context your em value resolves against.

Common PX to EM Conversions

Reference values assuming a 16px parent font size. Change the base in the tool to recalculate for any other context.

PixelsEM (16px parent)Typical Use
12px0.75emCaptions, fine print
14px0.875emSecondary text, labels
16px1emBody copy baseline
20px1.25emLead paragraphs, subheads
24px1.5emSection headings
32px2emPage titles

Frequently Asked Questions

What exactly is the parent font size in this tool?

It is the font-size of the element that your em value will be relative to. The browser computes em against the nearest ancestor's font-size, so set this field to whatever that parent renders at in your real CSS. The default of 16px matches the typical browser default for the body.

How is px converted to em?

Divide the pixel value by the parent font size: em = px ÷ parent. With a 16px parent, 24px becomes 1.5em. This tool does the math instantly and lets you control the number of decimal places shown.

Should I use em or rem?

Use em when you want sizing to scale with the local component — padding that grows with the button's text, for example. Use rem for global layout and typography where you want one predictable value across the whole page. Many designs combine both.

Why do my em values seem to multiply when nested?

That is compounding. Because each em is relative to its parent, nesting elements that each set an em font-size multiplies the effect. If you need values that stay constant no matter how deeply they are nested, use rem instead.

Is the conversion done in my browser?

Yes. The calculation runs entirely client-side as you type. Nothing is sent to a server, so it works instantly and offline once the page has loaded.

px
px
em

Common Conversions (parent: 16px)

12px = 0.75em
14px = 0.875em
16px = 1em
20px = 1.25em
24px = 1.5em
32px = 2em

Pixels (px)

Absolute CSS unit. 1px equals one device pixel. Good for exact measurements.

EM

Relative to the parent element's font-size. Useful for component-level responsive sizing.

em is relative to the parent element's font-size
16px = 1em (with 16px parent)
Set the parent font size to match your actual CSS context
Unlike rem, em values compound when elements are nested
Want to learn more? Read documentation →
1/5

CSS Unit Converter

PX to EM Converter (current page) PX to REM Converter REM to PX Converter
Start typing to search...
Searching...
No results found
Try searching with different keywords