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
Frequently Asked Questions
What is the difference between REM and EM?
rem (Root EM) is relative to the root element (usually <html>) 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 will scale proportionally, which is not possible with static pixel units.
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.