All toolsDisplay
CSS unit converter
Convert between pixels, rem and em using your font sizes.
Test panel
Questions about CSS unit converter
What root font size should I enter when converting a value to rem?
Enter the computed font size of the root HTML element for the layout you are working on. With a 16 px root, 24 px converts to 1.5 rem.
Which font size should I use for an em conversion?
Use the reference that applies to the property you are setting. For an em font-size declaration this is usually the inherited font size, while an em margin or padding uses the element’s computed font size.
Why can equal numbers of rem and em produce different pixel sizes?
They can use different font-size references. For example, with a 16 px root and a 20 px em reference, 2 rem converts to 32 px and 2 em to 40 px.