Pixels to Ems Converter

Convert fixed pixel values into flexible em and rem values. Set your root base (for rem) and context base (for em) so that your CSS matches the real project setup.

Common: 16px, or 10px (62.5%)

E.g. a card with font-size: 14px → put 14

Enter the value from design (Figma, XD, etc.)

Relative to context element

Relative to root html

Current conversion: 16px → 1em (context 16px) → 1rem (root 16px)

Tip: change context to 14px to see how 16px from design becomes 1.142857em.

Quick px → em table (context: 16px)

px em rem (root 16px)
80.50.5
120.750.75
140.8750.875
1611
201.251.25
241.51.5
3222

How the px → em → rem conversion works

px are absolute (device pixels), while em and rem are relative. Responsive web design prefers relative units because they scale with user settings and container font-sizes.

Formulas

em = px ÷ contextFontSize

rem = px ÷ rootFontSize

If you know em and want px: px = em × contextFontSize

em vs rem

em is relative to the current element’s font-size and compounds (nested elements can multiply the effect). rem is relative to the root HTML font-size and stays consistent throughout the document.

FAQ

1. Which unit should I use for padding/margin?

Use em if you want spacing to scale with the element’s text; use rem for consistent spacing across components.

2. My design is in Figma in px — what do I enter?

Enter the exact px from the design, then input the real font-size used in that component. The converter will output em/rem you can paste into your CSS.

3. Why is my number not round?

Because not all px values divide evenly by your chosen font-size. You can round to 3–4 decimals; browsers handle that fine.