How to Convert PX to REM (and Back) Without Guessing
Convert pixels to rem and rem to pixels in your browser for any root font-size. See the math, pick the right base, and read the reference table.
What rem actually depends on
There is no single px-to-rem answer, because rem is defined relative to the root element. On a page that sets html { font-size: 16px }, 1rem is 16px, so 24px is 1.5rem. Change the root to 20px and 24px becomes 1.2rem. That is the whole point of rem: it does not fix a size, it follows the reader's setting.
Browsers start with a 16px root, and that is why examples everywhere assume 16. But a user who raises their browser's default font size, or a site that sets a different root, moves every rem on the page. The conversion is only meaningful once you know the base, which is why this tool asks for it up front.
1. Set the base font-size
Move the slider to the root font-size your CSS uses, from 8px to 24px. Sixteen is the browser default and the starting value. The readout beside the slider always shows what 1rem equals at the current setting.
If you are converting a value from a design file and the project uses the standard root, leave it at 16. If the project deliberately sets html { font-size: 62.5% } so that 1rem is 10px, set the slider to 10 and every result follows.
2. Convert in either direction
The Pixels to rem box divides your pixel value by the base; the rem to pixels box multiplies your rem value by it. Both results update as you type and each has its own copy button, so you can paste a value straight into your CSS.
If a field is empty, the result shows a dash and its copy button is disabled rather than copying that dash. A value larger than 1,000,000 is refused the same way, so a pasted junk number cannot produce a silently wrong result.
3. Check the reference table
Below the converters, 20 common pixel values are listed with their rem equivalents at the current base, and the Preview column renders each one at its true pixel height so you can see the scale rather than only read the numbers. Change the base and the whole table recomputes.
Because the preview uses real pixels while the rem column shows the equivalent, the table doubles as a quick check that your base is set the way you expect: at a 16px base, 12px is 0.75rem, and at a 10px base the same 12px is 1.2rem.
Precision, limits and privacy
Results are shown to six decimal places with trailing zeros removed, which is enough for the values real stylesheets use. At a 16px base, 14.5px is exactly 0.90625rem, and 1px is 0.0625rem. Values that repeat forever, such as 1px at a 24px base, are rounded at the sixth decimal rather than truncated mid-digit.
Everything is computed in this tab from the two numbers you type and the base you pick; nothing is sent anywhere. This tool converts px and rem only — em depends on a parent element and viewport units depend on the viewport, so they need different inputs.
Try it free — PX ↔ REM Converter
Convert between px and rem for a configurable base font size, with a reference table of common values.
Open PX ↔ REM Converter