Convert pixels to em relative to a context font size (16px default). Free CSS converter.
| Input | Output |
|---|---|
| 16 px at 16px context | 1 em |
| 24 px at 16px context | 1.5 em |
| 12 px at 12px context | 1 em |
em is relative to the current element's (or nearest parent's) font size; rem is always relative to the root. Nested em values compound, rem does not.
Use the font size of the parent element the text sits in. When in doubt, 16px (the browser default) is a good estimate.
Because em inherits, a 1.5em element inside another 1.5em element renders at 2.25× the base. Use rem to avoid compounding.