DevToolPal
EN

CSS units

px to em Converter

Convert pixels (px) to em (em). 1 px = 0.0625 em, and 1 em = 16 px.

Formula

em = px ÷ 16

How to convert

To convert pixels to em, divide the value by 16. For example, 32 px = 2 em.

Conversion table

px em
1 px 0.0625 em
2 px 0.125 em
4 px 0.25 em
8 px 0.5 em
10 px 0.625 em
12 px 0.75 em
14 px 0.875 em
16 px 1 em
18 px 1.125 em
20 px 1.25 em
24 px 1.5 em
32 px 2 em
48 px 3 em
64 px 4 em

The table assumes a base font size of 16px. Change the settings in the converter above to match your project.

About these units

Browsers turn every CSS length into pixels. rem is relative to the root font size and em to the parent element's font size; both are 16px in every major browser unless the page or the user changes it. 1pt is 1/72 inch and 1px is 1/96 inch, so 1pt = 1.333px. vw is 1% of the viewport width, so its pixel size depends on the screen.

FAQ

› How do I convert px to em?

1 px = 0.0625 em. To convert, divide the value by 16: 32 px = 2 em.

› What is 1 em in px?

1 em = 16 px. The reverse formula is px = em × 16.

› Why use rem instead of px?

rem sizes follow the user's browser font size setting, which helps accessibility, and changing one root value resizes the whole layout consistently.

› What is the difference between rem and em?

rem always uses the root (html) font size. em uses the font size of the element's parent, so nested em values compound.