# Convert PX to EM

> Convert pixels to em online. Free PX to EM converter with a worked example and a live calculator for a configurable base font size.

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).

## Example: PX → EM

Input:
```
8px
16px
24px
40px
```

Output:
```
0.5em
1em
1.5em
2.5em
```

## How to convert PX to EM

1. Take the pixel value you want to convert.
2. Divide it by the current element's font size (16px by default).
3. The result is your value in em — e.g. 24 ÷ 16 = 1.5em.

## FAQ

### 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.

## Related converters

- [EM → PX](https://www.devkult.com/convert/em-to-px.md)
- [PX → REM](https://www.devkult.com/convert/px-to-rem.md)
- [EM → REM](https://www.devkult.com/convert/em-to-rem.md)

Open the interactive converter: https://www.devkult.com/convert/px-to-em