PX to EM Converter

Convert pixels to em instantly against the element's font size (16px by default). Unlike rem, em is relative to the nearest parent's font size, so it compounds when nested — handy for padding and margins that should scale with their own text. The table below shows common px-to-em values at a 16px base.

Pixel to em at a 16px font size

PixelsEM
4px0.25em
8px0.5em
12px0.75em
14px0.875em
16px1em
18px1.125em
20px1.25em
24px1.5em
32px2em
40px2.5em
48px3em
64px4em

When to use it

  1. Size padding or margins relative to a component's own font size.
  2. Build scalable buttons where spacing grows with the label text.
  3. Port a pixel spec to em for a typography-driven layout.

How to Use

  1. Type your pixel value into the PX field — for example, 12.
  2. The em equivalent appears in the EM field, relative to the parent font-size you've set.
  3. Set the Parent Font Size to match the actual computed font-size of the element's parent (default 16px).
  4. Use the reference table for typical pixel values you'd encounter in component-local spacing.
  5. Copy either value with one click into your component's CSS.

Features

  1. Calculates em relative to a configurable parent font-size
  2. Default 16px parent matches the browser root — adjust per component
  3. Reference table for common pixel values in component sizing
  4. Bidirectional: PX in or EM in, the other updates instantly
  5. Privacy-first — no design data leaves your browser

FAQs

What's the difference between em and rem?

Rem (root em) is relative to the html element's font-size — always the same across your whole page. Em is relative to the current element's own font-size, so it cascades and compounds. If a parent has font-size: 20px and a child uses padding: 1em, the padding is 20px. If you nest another child with font-size: 0.875em, its font-size becomes 17.5px and its 1em becomes 17.5px too. Em is powerful for component-local scaling; rem is safer for global consistency.

When should I use em over rem?

Use em when you want a property to scale with the element's own font-size. Common cases: padding inside a button (so larger buttons get proportional padding), letter-spacing on headings (which often needs to be relative to font-size), media-query breakpoints (em-based media queries respect user zoom in older browsers), and component-local spacing. Use rem for global typography and layout to avoid the compounding surprise.

What is the default parent font-size?

If you don't set a font-size on any ancestor, the default is the browser's root font-size — usually 16px. This calculator defaults to 16, which is the most common parent context. If you're converting for a component nested inside a specific parent (a card title set to 24px, for example), enter 24 in the base field to get the em value relative to that parent.

How does em compounding work?

Each nested element with a font-size in em multiplies through its ancestors. A child at 0.8em inside a parent at 1.2em (which is itself inside the root) produces a computed font-size of 0.8 × 1.2 × 16 = 15.36px. This compounding can lead to surprising values deep in a component tree, which is why rem (no compounding) became popular for global typography. Em is still useful for intentional proportional scaling within a single component.

Technical Details

EM units are relative to the element's own font-size (or the parent's font-size when used on font-size itself). The formula em = px / parentFontSize mirrors REM conversion but uses a per-element base rather than the document root. The tool lets users adjust the base font-size to match their component context, making it useful for nested typographic systems.

Calculators & Converters

Calculators & Converters

  • EM to PX Converter
  • PX to Percentage Converter
  • Percentage to PX Converter
  • Base Unit to PX Converter
  • PX to Base Unit Converter
  • PX to Tailwind Converter
  • Tailwind to PX Converter
  • Golden Ratio Calculator