Convert px to em
Enter pixel values one per line or paste CSS containing px lengths. The output divides each matching value by 16 and adds the em unit.
24px becomes 1.5em, and 8px becomes 0.5em.
EM reference size
Unlike rem, em is contextual. Font sizes use the parent element as their reference, while many other properties use the current element’s computed font size.
The focused conversion uses a 16px reference. Open the full converter when the relevant element uses another size.
CSS replacement
Pasted declarations keep their formatting. Only values with a px suffix are changed; other units and unitless values remain as written.