PX to REM Converter
Enter a size, choose the direction and the base font size. You get the converted value and a table of common pixel sizes in rem.
Your numbers
How we calculate it
A rem is the font size of the root element, which is the html element. Browsers set it to 16 px unless the user or the page changes it. So rem = px ÷ base and px = rem × base.
With the default 16 px base, 24 px is 24 ÷ 16 = 1.5 rem, and 1 rem is 16 px. If your CSS sets the root to 10 px (some sites use 62.5% for easy sums), 24 px is 2.4 rem.
Assumptions and limits
- An em is relative to the parent element, so it can compound when elements are nested. The rem always follows the root, so the sums here are for rem. They match em only when the parent has the base size.
- Using rem lets text follow the size a person picked in their browser settings. That helps accessibility, because pixel sizes do not scale.
- Results are shown to 6 significant digits. Negative values work, for example for a negative margin.
Frequently asked questions
How many px is 1 rem?
By default 1 rem is 16 px. It changes if the root font size is changed, and then the number you type in the base box is the number to use.
How do I convert px to rem?
Divide the pixels by the root font size. At 16 px, 14 px is 0.875 rem, 18 px is 1.125 rem and 32 px is 2 rem.
Should I use rem or px?
Use rem for font sizes and spacing that should scale with the reader's settings, and px for fine details such as 1 px borders where scaling is not wanted.
Related calculators
- Aspect Ratio CalculatorEnter the original width and height, then the new width or the new height you want.
- Hex to RGB Color ConverterType a color as hex, rgb() or hsl().
- Binary and Hex ConverterType a whole number, say which base it is in and which base you want.
- Length ConverterEnter a length, choose the unit it is in and the unit you want.
Worked example (a fixed example using the starting numbers, it does not change as you type)
Inputs: Value = 24; Convert = Pixels (px) to rem; Base font size (px) = 16.
- Result 1.5 rem
- Conversion 24 px = 1.5 rem at a base of 16 px
Embed this calculator
Add this calculator to your own page. Paste the code where you want it. The small link keeps credit to the source.