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.
| Pixels | EM |
|---|---|
| 4px | 0.25em |
| 8px | 0.5em |
| 12px | 0.75em |
| 14px | 0.875em |
| 16px | 1em |
| 18px | 1.125em |
| 20px | 1.25em |
| 24px | 1.5em |
| 32px | 2em |
| 40px | 2.5em |
| 48px | 3em |
| 64px | 4em |
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.
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.
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.
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.
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.