PX to REM Converter
Convert pixels to rem and em units for CSS, and back.
About the PX to REM Converter
Choose the direction, enter the value and the root font size (16px unless your site changes it). The calculator gives the rem value, which equals the em value when the parent uses the same font size.
rem is relative to the root (html) font size, 16px by default in browsers; em is relative to the parent element's font size. Using rem for text respects users who enlarge their default font size, an accessibility benefit.
The formula
rem = px ÷ root font size
Worked example
24px with the default 16px root
- 24 ÷ 16 = 1.5rem
- Back again: 1.5 × 16 = 24px
- 14px is 0.875rem; 32px is 2rem
Questions people ask
Why use rem?
Text scales with the user's browser font settings.
Should I set html to 62.5%?
It makes 1rem = 10px but can surprise third-party components; many prefer keeping 16px.
Should borders use rem?
Usually not: thin borders stay crisp in px, while text, spacing and layout widths scale well in rem.