Convert pixel values to em units relative to the parent element's font size, or em back to pixels. Paste a whole list of values, see the matching percentage and rem, and work out the real parent size when ems are nested.
Last updated:
Direction
One value, or several separated by commas or spaces.
px
The font-size of the parent element (16px browser default).
Each em size compounds: 16px × 1.25 × 0.875 = 17.5px parent.
Enter your values to see the result.
Advertisement
Advertisement
How to use the PX to EM Converter
Pick the direction: PX → EM or EM → PX.
Enter one value or a list such as 12, 14, 18, 24.
Set the parent font size in px (16px if the parent uses the browser default).
If the parent itself is sized in em, tick the nesting box and list the ancestor em values.
Copy the result or download the tables as CSV.
PX to EM formula
em = px ÷ parent font size and px = em × parent font size. When ems are nested, the parent font size is itself the product of the root size and every ancestor's em value: 16px × 1.25 × 0.875 = 17.5px.
PX to EM at a 16px base
px
em
px
em
px
em
8px
0.5em
16px
1em
28px
1.75em
10px
0.625em
18px
1.125em
32px
2em
12px
0.75em
20px
1.25em
36px
2.25em
13px
0.8125em
22px
1.375em
40px
2.5em
14px
0.875em
24px
1.5em
48px
3em
15px
0.9375em
26px
1.625em
64px
4em
When to use em
Component spacing: padding and margins in em grow with the component's own text, so a button stays proportional at any font size.
Media queries: em-based breakpoints (e.g. @media (min-width: 48em)) follow the user's default font size.
Avoid deep nesting for font sizes: use rem when you want a predictable size anywhere on the page.
Frequently asked questions
How do I convert px to em?
Divide the pixel value by the parent element's font size: em = px ÷ parent font size. With the default 16px, 24px = 24 ÷ 16 = 1.5em.
How do I convert em to px?
Multiply: px = em × parent font size. For example 0.875em inside a 16px parent is 14px.
What is the difference between em and rem?
em is relative to the font size of the element's parent (for font-size) or the element itself (for other properties like padding), so it compounds when nested. rem is always relative to the root html element's font size, so 1rem is the same everywhere on the page.
Why do nested em values compound?
Each em font size is calculated from its parent, so a 1.25em list inside a 1.25em container is 1.25 × 1.25 = 1.5625 times the root size. Tick the nesting option to calculate the real parent size from a chain of ancestor em values.
What is 1em in px?
1em equals the computed font size of the parent element. In a browser with default settings and no CSS changes, that is 16px.
Is em relative to the parent for padding and margin?
No. For properties other than font-size, em is relative to the element's own computed font size. If an element has font-size: 20px, then padding: 1em is 20px.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.