By Mudasir Ahsan (Founder) · Updated 10 November 2026
On this page
How to use the px to rem converter
- Pick the direction: px to rem or rem to px.
- Type the value you have. For px to rem it is the pixel size from your design file. For rem to px it is the rem value from a stylesheet.
- Leave the root font size at 16px unless your CSS sets
html { font-size }to something else.
Results update as you type, with the working shown underneath and a conversion table for the most common sizes at your root.
Two more rows show the value as a percentage of the root, and what it would render at if a visitor raised their browser's default font size to 20px or 24px. That second row is the reason rem exists. A 24px heading stays 24px for everyone, while a 1.5rem heading grows to 30px or 36px for people who need bigger text.
The px to rem formula
A rem is the font-size of the root element, normally the html tag, so 1rem always equals whatever that element is set to. MDN notes that a common browser default is 16px, but user-defined preferences may modify this. Both formulas are one step:
- rem = px ÷ root font size
- px = rem × root font size
With the 16px default, 24 ÷ 16 = 1.5rem, and going back, 1.5 × 16 = 24px.
Sizes people look up most are easy to remember, because 16 divides evenly into eighths: 10 px to rem is 0.625rem, 14 px to rem is 0.875rem, 16px to rem is exactly 1rem, 18 px to rem is 1.125rem, 24 px to rem is 1.5rem, 4px to rem is 0.25rem and 1px to rem is 0.0625rem.
Check your root before you convert. Some projects use the 62.5% font size trick (html { font-size: 62.5% }), which makes the root 10px so that 1rem = 10px. Type 10 into the root box and 16px becomes 1.6rem, and every other result follows. It makes mental arithmetic easier, but my advice is to leave the root alone and let a converter do the dividing, as most modern style guides now do. If you inherit a project that already uses it, keep it; switching halfway breaks every rem value at once. The FAQ below explains what it can break.
Px to rem table at the 16px default
| px | rem | Percent of root | Typical use |
|---|---|---|---|
| 1px | 0.0625rem | 6.25% | Hairline borders |
| 2px | 0.125rem | 12.5% | Focus rings, thick borders |
| 4px | 0.25rem | 25% | Smallest spacing step |
| 8px | 0.5rem | 50% | Base spacing unit |
| 10px | 0.625rem | 62.5% | Tiny labels (too small for body text) |
| 12px | 0.75rem | 75% | Captions, legal text |
| 13px | 0.8125rem | 81.25% | Dense UI text |
| 14px | 0.875rem | 87.5% | Secondary text, table cells |
| 15px | 0.9375rem | 93.75% | |
| 16px | 1rem | 100% | Body text |
| 18px | 1.125rem | 112.5% | Lead paragraphs, large body |
| 20px | 1.25rem | 125% | h4 / h5 |
| 24px | 1.5rem | 150% | h3, large text in WCAG terms |
| 28px | 1.75rem | 175% | |
| 32px | 2rem | 200% | h2 |
| 36px | 2.25rem | 225% | |
| 40px | 2.5rem | 250% | h1 on small screens |
| 48px | 3rem | 300% | h1 |
| 64px | 4rem | 400% | Display headings |
| 96px | 6rem | 600% | Hero numbers |
Every value in the table is exact, because each px value is a whole number of sixteenths. Sizes that aren't, such as 15px at an 18px root (0.8333rem), are shown to four decimals. That is more than enough, since browsers round the final computed size to a fraction of a device pixel anyway.
Rem to px in CSS: reading a stylesheet
Rem to px is the question you ask when you read someone else's CSS. How big is padding: 0.75rem 1.25rem? Multiply by the root size. At 16px that is 12px top and bottom and 20px left and right. In the same way max-width: 65rem is 1040px and gap: 2.5rem is 40px. Switch the converter to rem to px and type the number, or read the table above from right to left. To confirm a value on a live page, the "Computed" tab in the browser's developer tools shows the final pixel size of any element.
One catch. In a media query, rem and em ignore your html { font-size } rule and use the browser's initial font size (normally 16px). So @media (min-width: 48rem) is 768px even on a site that uses the 62.5% trick. This is by design: breakpoints track the user's font preference and not the stylesheet.
Px to rem converter for font sizes and spacing
Designers hand over pixel values, and CSS works best in rem for anything that should scale with the reader's text setting. This is the split I'd use:
| What | Unit | Why |
|---|---|---|
| Font sizes | rem, always | A 14px label as 0.875rem shows at 17.5px for a visitor with a 20px default, instead of staying stuck at 14px |
| Spacing, max-widths, gaps | usually rem | Layouts loosen up along with the text; 8px is 0.5rem, 16px 1rem, 24px 1.5rem |
| Borders, shadows, hairlines | px | A 1px border should stay one pixel; 0.0625rem can round to 0 or 2 pixels after zoom |
| Media query breakpoints | either | Both work, with the initial-font-size catch above |
Most spacing scales are multiples of 4px, so the rem values come out as clean quarters. If a design uses odd values like 13px or 15px everywhere, round them to the scale before converting. Nobody can see a 1px difference in padding, but everyone maintaining the CSS will notice 0.8125rem.
If your font sizes are in rem and the text still looks too small or too large at the user's setting, the units are rarely the problem. It's usually the scale between sizes. Our font size calculator builds a ratio-based scale and outputs every step in rem.
Rem vs px vs em
Rem has one fixed reference, the root, so 1.5rem is the same size everywhere on the page.
Em is relative to the font size of the element's parent. 1.5em inside a 20px card is 30px, inside a 14px footnote it is 21px, and nested em values multiply. Em is the right unit when something should scale with its own container, such as the padding inside a button or an icon next to its label. Rem is right for everything that should scale with the page. The px to em converter handles the parent-relative case, including the compounding.
Px is absolute within the page. It never follows the user's font-size setting, though it does scale with browser zoom (Ctrl + plus), because zoom resizes the CSS pixel itself. The WCAG "resize text" criterion asks that text can be enlarged to 200% without loss, and zoom satisfies that. Respecting the font-size preference is what rem gives you on top.
Need real-world sizes too? The pixels to inches converter covers physical units and screen density.
