Convert PX to EM
Em units are relative to the font size of their own element, which makes them ideal for component-local spacing that scales with text. This converter turns pixel values into em against a base font size (16px by default).
8px 16px 24px 40px
0.5em 1em 1.5em 2.5em
Try it with your own data
How to convert PX to EM
- Take the pixel value you want to convert.
- Divide it by the current element's font size (16px by default).
- The result is your value in em — e.g. 24 ÷ 16 = 1.5em.
Frequently asked questions
What is the difference between em and rem?
Em is relative to the font size of the current element; rem is always relative to the root element. Em compounds when elements nest, rem does not.
When should I use em?
Em shines for padding, margins, and borders that should grow proportionally with an element's own text — for example, button padding that scales with the button's font size.
What is the difference between REM and EM?
rem (Root EM) is relative to the root element (usually the <html> element) font size. em is relative to the font size of its nearest parent element.
Why use REM instead of pixels?
Using rem units is crucial for accessibility. If a user changes their browser's default font size, your entire layout scales proportionally — something static pixel units can't do.