Px to Rem Converter
Instantly convert pixels to REM units for accessible, scalable web typography. Calculated against your root font size.
Root Font Size
Default is 16px for most browsers
Quick Reference Guide
Why use REM units?
REM (Root EM) units are relative to the root element (usually <html>) font-size. By using REMs, your layout respects the user's browser settings. If a user increases their default font size for accessibility, your entire site scales proportionally.
Tailwind CSS Best Practices
Modern frameworks like Tailwind use REMs by default (e.g., w-4 = 1rem = 16px). Using REMs ensures your custom components align perfectly with the framework's utility classes.
Calculation Formula
// Example
1.5rem = 24px / 16px
Go Deeper
For the full method, which unit belongs on type, spacing, and breakpoints, plus the WCAG resize rule behind it, read the PX vs REM vs EM guide.
How the px to rem conversion works
A rem is a length equal to the font size of the root element, the html element. The converter divides the pixel value from a design file by the root size you set: rem = px / root. With the root at 16px, 24px becomes 1.5rem and 14px becomes 0.875rem. Results are to four decimal places and trailing zeros are dropped, so 13px at a 16px root shows as 0.8125rem. The arithmetic happens in your browser and nothing is sent anywhere.
Why the root size is an input
MDN describes the default browser font size as usually 16px, and that is the tool's default. It is a default, not a constant. Readers can raise it in browser settings, and the CSS on your own site can change it. If your stylesheet sets html { font-size: 62.5% }, the root becomes 10px in a default browser, and 24px converts to 2.4rem instead of 1.5rem. Set the root field to whatever your html rule produces before converting a spec, or every value will be off by the same factor.
A worked type scale
Here is a common set of design-file sizes converted at a 16px root, and what each one renders at for a reader who has set their browser default to 20px. The right-hand column is the reason to convert at all: sizes in rem follow the reader's setting, while sizes left in px stay fixed.
| Design file (px) | rem at 16px root | Rendered at a 20px reader default | Same value left in px |
|---|---|---|---|
| 12px | 0.75rem | 15px | 12px |
| 14px | 0.875rem | 17.5px | 14px |
| 16px | 1rem | 20px | 16px |
| 18px | 1.125rem | 22.5px | 18px |
| 20px | 1.25rem | 25px | 20px |
| 24px | 1.5rem | 30px | 24px |
| 32px | 2rem | 40px | 32px |
| 48px | 3rem | 60px | 48px |
MDN's font-size reference states the accessibility point directly: defining font sizes in px is not accessible, because some browsers do not let the reader change them, and it recommends values relative to the user's default font size. Browser zoom scales px and rem alike, but the text-size setting only reaches relative units. WCAG 2.2 success criterion 1.4.4 asks that text can be resized to 200 percent without loss of content or function, and rem-based type, spacing and containers make that far easier to meet.
Where px still belongs
Converting everything is not the goal. Hairline borders (1px), box shadows, and some icon strokes are meant to stay crisp at a fixed width and are usually better left in px. Media queries written in em or rem respond to the reader's text size as well as the window, which is often what you want for layout breakpoints. Line height is best written without a unit (1.5, not 24px), so it scales with each element's own font size. And em, unlike rem, compounds through nested elements, which suits padding on a button that should grow with its own label but surprises people when used for font sizes deep in a component tree.
Assumptions and limits
The converter assumes the root size you enter is the computed font size of the html element. It does not read your stylesheet, and it does not know about container query units, viewport units or clamp() expressions; for fluid type, convert the minimum and maximum sizes separately and build the clamp() yourself. Very small results (under 0.75rem, 12px at a 16px root) are worth a second look for readability, whatever unit they are written in.
For the full reasoning on units, including em, ch and viewport units, read the px vs rem vs em guide. To turn converted sizes into a consistent ramp, the typography scale system guide walks through ratios and fluid steps, and the WCAG compliance guide covers the resize and text-spacing criteria that rem units help you pass.
Sources: MDN Web Docs, font-size (rem relative to the root element; default usually 16px; px font sizes not accessible), https://developer.mozilla.org/en-US/docs/Web/CSS/font-size, and W3C WCAG 2.2 success criterion 1.4.4 Resize Text, https://www.w3.org/TR/WCAG22/, both checked October 22, 2026. Table values are this tool's own arithmetic.