What Is a PX to REM Converter?
This tool converts between pixel (px) and rem units instantly. Rem units are the foundation of accessible, responsive CSS — they scale proportionally when users adjust their browser's default font size, while pixel values stay fixed. Converting your CSS from px to rem improves accessibility for millions of users with low vision.
The Conversion Formula
The formula is simple: rem = px ÷ base font size. With the default base of 16px, 24px = 1.5rem. This tool includes an adjustable base size, a full reference table, and a bulk converter that turns the px values in a pasted CSS block into rem. It leaves url() paths, quoted strings and @media or @container conditions alone, and can keep 1px hairlines in px.
How to Use This PX To Rem
- Enter a pixel value — Type the pixel size you want to convert — common values include 12, 14, 16, 18, 20, 24, 32, 48px.
- Set the base font size — The default is 16px (browser standard). Change this if your project uses a different root font size.
- Read the rem value — The tool instantly shows the equivalent rem value. For example, 24px ÷ 16 = 1.5rem.
- Use the reference table — The built-in conversion table shows common px-to-rem mappings for quick reference.
Worked example: rem versus px when the reader enlarges text
On October 12, 2026 we set Chromium's default font size to 16 px and then 20 px (as a reader would under Settings → Appearance → Font size) and read the computed size of the same text written both ways.
| CSS | Default 16 px | Default 20 px |
|---|---|---|
font-size: 1.5rem | 24px | 30px |
font-size: 24px | 24px | 24px |
We also pasted a CSS block with the usual edge cases into the bulk converter at the default 16 px base:
| Input | Output | Result |
|---|---|---|
padding: 24px -8px | 1.5rem -0.5rem | negatives converted |
margin: .5px | 0.0313rem | rounded to 4 decimals (0.03125) |
border: 1px solid | 1px | kept (hairline option on) |
url(icon-20px.png) | unchanged | paths left alone |
content: "12px" | unchanged | strings left alone |
@media (min-width: 768px) | unchanged | conditions left alone |
calc(100% - 32px) | calc(100% - 2rem) | converted inside calc() |
- Only rem follows the reader's font setting. The rem text grew from 24 to 30 px; the px text stayed at 24. Browser zoom (Ctrl/Cmd +) scales both, but the font-size setting is what many low-vision users rely on, and WCAG 1.4.4 asks that text can be resized to 200%.
- The bulk converter is safe on real stylesheets. Paths, strings and media-query conditions stay untouched, and calc() expressions convert correctly.
- Keep media queries in px or convert them by hand. A rem inside a media query is measured against the browser default, not your html font size, which is why the converter leaves them alone.
Sources
Checked on .
Frequently Asked Questions
📖 Learn More
Related Article The Complete Guide to CSS Units → Related Article How to Convert PX to REM Units →Built by Derek Giordano · Part of Ultimate Design Tools