01What is PX to REM?
One rem equals the font size set on the html element. That makes the conversion a single division: rem equals pixels divided by the root size. This converter does it in both directions, which is handy when a design spec says 24px and your codebase speaks rem. Type a number in the Pixels (px) field and the REM field fills in. Type in the REM field and the pixel value fills in instead. The Base font size field starts at 16, the default root font size in major browsers when the user hasn't changed their settings. Change the base and the current pixel value is recalculated on the spot. So 32px reads as 2rem at a 16px base and 3.2rem at a 10px base. The CSS Values and Units spec defines rem as relative to the font size of the root element. That's why the base matters so much. If your stylesheet sets html { font-size: 62.5% }, a browser at its default gives you a 10px root, and you should set the base to 10 here. Rounding is simple and predictable. Rem results keep up to four decimal places and pixel results keep up to two, with trailing zeros trimmed. For example, 13px at a 16px base gives 0.8125rem. Going the other way, 0.3333rem gives 5.33px. Each field has a copy button that copies the value with its unit attached, like 1.5rem or 24px, so you can paste straight into CSS. Under the inputs, a Common Values grid lists 18 sizes from 8px to 96px with their rem equivalents at your current base. Click any of them to load it into the converter. It's a quick way to sanity-check a spacing or type scale. What it won't do: it converts one value at a time, and it only knows px and rem. It doesn't touch em or percentages. Those depend on the parent element's computed font size, and a standalone calculator has no way to know that. It also won't rewrite a whole stylesheet for you. All the math happens in the page with plain JavaScript, so the numbers you type never leave your browser.
Frontend developers turning pixel values from design files into rem units that respect a user's browser font size. The tool runs entirely in your browser, so your data never leaves your device.
02How to use PX to REM
- Set Base font size to your root font size in pixels (16 unless your CSS changes it).
- Type a value in Pixels (px) to get rem, or in REM to get pixels.
- Or click one of the Common Values buttons to load that pixel size.
- Use the copy button next to either field to copy the value with its unit.
03Worked examples
- Input:
24 px, base 16 - Result:
1.5 rem - Input:
13 px, base 16 - Result:
0.8125 rem - Up to 4 decimals are kept and trailing zeros are trimmed.
- Input:
1 px, base 16 - Result:
0.0625 rem - Input:
24 px, base 10 - Result:
2.4 rem - Changing the base font size recalculates the current px value.
- Input:
1.5 rem, base 16 - Result:
24 px - Input:
0.3333 rem, base 16 - Result:
5.33 px - The rem-to-px direction rounds to 2 decimals.
04Common use cases
- Converting pixel sizes from a Figma spec into rem for a stylesheet
- Refactoring legacy CSS from px to rem so text follows the user's browser font setting
- Checking rem equivalents for a spacing scale such as 4, 8, 12, 16, 24 and 32px
- Working out values for a project that sets html { font-size: 62.5% } (a 10px base)
- Finding the pixel size of a rem value from a design token file
- Double-checking an odd value like 13px before committing 0.8125rem to a component
05Tips
- Use rem for font sizes and spacing so a user who raises their browser's default font size gets a proportionally larger layout; px values ignore that preference.
- Setting html { font-size: 62.5% } makes 1rem = 10px for easier mental math, but every rem value in the project then changes, including third-party components that assume 16px.
- em is relative to the element's own computed font size (or the parent's, when used on font-size itself), which makes it handy for padding that should scale with a button's text.
- Media queries in rem or em are based on the browser's initial font size, not your html font-size, so a 62.5% root doesn't change where they trigger.
06Related concepts
CSS units, Responsive design, Root font size, Accessibility.
Frequently Asked Questions
What is PX to REM?
PX to REM is a free, browser-based developer tool on AIDToolStack. Convert pixels to rem units and vice versa with a common values reference. It requires no installation or sign-up and works entirely in your browser.
Is PX to REM free to use?
Yes. No sign-up, no fees and no usage cap.
Does PX to REM store my data?
No. It runs in your browser; nothing is uploaded.