PX to REM Converter
Convert pixels to rem for CSS with any root font size (16px by default), and see a table of common sizes.
| px | rem |
|---|---|
Runs in your browser. What you enter is kept for 30 days to improve Toolgrid, then deleted.
How to use the PX to REM Converter
- 1 Enter the size in pixels.
- 2 Change the root font size if your site doesn’t use the browser default of 16px.
- 3 Copy the rem value or look it up in the table.
About the PX to REM Converter
Rem stands for "root em": a size relative to the font size of the html element. With the browser default of 16 pixels, 1rem equals 16px, so 24px is 24 ÷ 16 = 1.5rem.
The formula is rem = px ÷ root font size. If your stylesheet sets html { font-size: 62.5% } the root is 10px and 24px becomes 2.4rem; enter 10 as the base to convert for that setup.
Using rem for font sizes, spacing and layout makes a site respect the text size people choose in their browser settings, which is important for accessibility. Values are rounded to four decimals.
Frequently asked questions
How many pixels is 1rem?
16 pixels by default, because browsers use 16px as the default font size. If the html element has a different font size, 1rem is that size.
What is the difference between rem and em?
Rem is relative to the root (html) font size, em to the font size of the element itself or its parent. Rem stays the same everywhere on the page; em compounds when elements are nested.
Why use rem instead of px?
Rem sizes scale when someone changes the default text size in their browser, so your design stays readable and accessible.
What is the 62.5% trick?
Setting html { font-size: 62.5% } makes 1rem equal to 10px, which makes mental maths easy. Remember to set a readable font size on the body again.