Skip to content
FeetToPixelsDPI / PPI / CSS

Formula

em = px / parent font size

Quick Reference (Parent Font Size (px): 16)

Pixels (px)EM
80.5
100.625
120.75
140.875
161
181.125
201.25
241.5
281.75
322
362.25
402.5
483
563.5
644

CSS Converters

PX to EM Converter: Convert Pixels to EM Units Online

To convert pixels to EM, divide pixels by the parent element's font size. If parent is 16px, then 24px equals 1.5em. Unlike REM, EM is relative to the parent, not the root.

Convert PX to EM units for CSS. Set parent font size and convert pixels to em values. Includes EM to PX reverse converter. Free online CSS unit converter.

PX to EM Converter: Convert Pixels to EM Units Online

To convert pixels to EM, divide pixels by the parent element's font size. If parent is 16px, then 24px equals 1.5em. Unlike REM, EM is relative to the parent, not the root.

Convert PX to EM units for CSS. Set parent font size and convert pixels to em values. Includes EM to PX reverse converter. Free online CSS unit converter.

How the PX to EM Converter Works

The EM unit in CSS is relative to the font-size of the element itself (or its parent when used for properties other than font-size). The conversion formula is: em = px / parent-font-size. With a default parent font-size of 16px, 24px becomes 24/16 = 1.5em, 12px becomes 0.75em, and 32px becomes 2em. The PX to EM converter handles this division and lets you override the parent size to match a specific component context.

The catch with EM is that it cascades. If a div has font-size: 1.5em and contains a span with font-size: 1.5em, the span ends up at 1.5 x 1.5 = 2.25em relative to the root. This cascading behavior helps when you want a component to scale proportionally with its container, but it's also the compounding problem that pushed developers toward REM for root-consistent sizing. Our em-vs-rem comparison goes deeper, and the px-to-rem tool covers the root-based alternative.

EM works well for component-relative spacing. Setting button padding to 0.5em 1em guarantees the padding scales with the button's own font size. Increase the button from 14px to 18px and the padding grows proportionally without any extra code. That's why design systems like Bootstrap and Tailwind use EM for many internal spacing tokens.

When to Use EM Over Other Units

EM is the right choice when you want sizing tied to a specific component's font-size rather than the page root. Typical scenarios include:

  • Button, badge, and chip padding that should scale with text size - 0.5em 1em works at every size.
  • Heading letter-spacing, where the gap should grow and shrink with the heading's own font-size.
  • Icon sizing inline with text - font-size: 1em on an SVG makes it match the surrounding copy.
  • Media query breakpoints (e.g. @media (min-width: 48em)) which respond to user font-size preferences.
  • Form control internal padding and border radii, so controls remain proportional as text scales.
  • Nested list indentation where each level should indent relative to its own font-size.

Practical Examples

The table below shows the most common pixel values converted to EM, assuming a standard 16px parent font-size. Use the converter above for any non-standard parent context.

PixelsEM (at 16px base)EM (at 14px base)EM (at 20px base)
10px0.625em0.714em0.5em
12px0.75em0.857em0.6em
14px0.875em1em0.7em
16px1em1.143em0.8em
18px1.125em1.286em0.9em
20px1.25em1.429em1em
24px1.5em1.714em1.2em
32px2em2.286em1.6em
48px3em3.429em2.4em

Common Mistakes to Avoid

EM's compounding behavior makes it powerful but error-prone. Watch for these traps when refactoring px values to em.

  • Assuming 1em always equals 16px. It only does when the parent's computed font-size is 16px, which isn't guaranteed inside nested components.
  • Using EM for deeply nested text where compounding makes the innermost element surprisingly large or small.
  • Mixing EM and REM without a clear rule. Inconsistent usage makes sizing drift unpredictably across the codebase.
  • Forgetting that EM on the font-size property is relative to the parent, while EM on other properties is relative to the element's own font-size.
  • Hard-coding pixel equivalents in comments that go stale when someone changes the parent font-size.
  • Using EM for layout widths where the cascading behavior produces hard-to-debug sizing.

Practical Quality Notes for PX to EM Converter

This calculator is most helpful when the result is tied to a real workflow, not treated as a loose number. For PX to EM Converter, verify the CSS reference value, the component context, and the viewport or font-size setting used by the layout. That context prevents the common mistake of copying a pixel value into a print, web, or CSS workflow where the reference size is different.

PX to EM Converter depends on the parent or current element font size, so nested components can compound if each layer uses em sizing. If the number looks unexpectedly large or small, check the unit direction first, then check the DPI, base font size, viewport width, or physical measurement that controls the calculation.

A good review pass for PX to EM Converter is simple: calculate once, compare against a known example, and preview the final output at the size people will actually see. To convert pixels to EM, divide pixels by the parent element's font size. If parent is 16px, then 24px equals 1.5em. Unlike REM, EM is relative to the parent, not the root.

Checks Before You Use the Result

  • Confirm that PX to EM Converter is using the same input unit your source file or design brief uses.
  • Save the DPI, viewport, or font-size setting next to the final PX to EM Converter value so another person can reproduce it.
  • Preview the PX to EM Converter output on the target medium before sending it to print, publishing it, or adding it to CSS.
  • Recalculate PX to EM Converter after resizing, cropping, changing aspect ratio, or changing the root font-size or viewport assumption.

When the Number Needs a Second Look

Recheck the result if the project moves from screen to print, from desktop to mobile, from one social platform placement to another, or from a draft export to a production file. Small context changes can make a correct PX to EM Converter answer wrong for the final job.

Sources

Reference Sources

These external references support the page's conversion formulas, resolution guidance, and unit explanations.

Frequently Asked Questions

Rem is always relative to the ROOT element (html) font size. Em is relative to the PARENT element's font size. Rem is predictable and consistent sitewide. Em compounds through nesting, which can cause unexpected sizes in deeply nested elements.

Divide the pixel value by the parent element's font size. Formula: em = px / parent font size. If the parent is 16px: 24px = 1.5em. If the parent is 20px: 24px = 1.2em.

1em when the parent font size is 16px. But if the parent is 20px, 16px = 0.8em. Em is always relative to the parent, not the root.

Use em when you want sizing relative to the component's own font size. For example, padding of 1em around text always creates proportional spacing regardless of the text size. Use rem for consistent sizing across the entire page.

EM allows components to scale proportionally. A button with font-size, padding, and border-radius all in em units will scale up or down uniformly when you change just the font-size, making responsive component design easier.

When nested elements use em, sizes multiply. A 1.5em font inside a 1.5em container becomes 2.25x the root size (1.5 x 1.5). This cascading effect can cause unexpected sizing. REM solves this by always referencing the root element.