Pixel to REM Calculator
Convert px values to rem units based on your root font size — single values, batch lists, or full CSS
Quick Reference Table
Common px to rem conversions based on current root font size (16px)
| Pixels | REM | Pixels | REM | Pixels | REM |
|---|
Drop in a pixel value — or an entire stylesheet — and get rem units back instantly, matched to whatever root font size your project actually uses. Single conversions, batch lists, and full CSS mode are all here so you don't have to divide by 16 in your head fifty times a day. And everything runs in your browser. Nothing gets uploaded.
How It Works
The math is simple: rem = px ÷ root font size. With the default 16px root, 24px becomes 1.5rem. Change the root to 10px (the 62.5% trick) and 24px becomes 2.4rem instead. The tool applies this formula to every px value it finds — whether that's one number you typed in or hundreds buried in a stylesheet.
Examples
Converting a heading size from Figma
Your designer specifies 32px for h2 headings. Root is the default 16px.
32px (root: 16px)
2rem
Batch converting a spacing scale
You've got a whole set of spacing tokens that need converting at once. Paste the list and it handles all of them.
4px
8px
12px
16px
24px
32px
48px
64px
0.25rem
0.5rem
0.75rem
1rem
1.5rem
2rem
3rem
4rem
Swapping px for rem inside real CSS
You have a component stylesheet full of pixel values and want them all converted without touching each line manually.
.card {
padding: 24px 16px;
font-size: 14px;
border-radius: 8px;
margin-bottom: 32px;
}
.card {
padding: 1.5rem 1rem;
font-size: 0.875rem;
border-radius: 0.5rem;
margin-bottom: 2rem;
}
Who Uses This
Converting pixel-based designs to rem-based CSS for accessible, scalable layouts.
Translating Figma or Sketch specs (always in px) into developer-ready rem values.
Making sure layouts scale properly across screen sizes and user font preferences.
Switching from px to rem so text and spacing respect browser zoom and font size settings.
Common Mistakes
If your project uses html { font-size: 62.5%; } (which sets the root to 10px), but you convert with the default 16px root, every rem value will be wrong. Always check your actual root size first and set it in the tool before converting.
A 1px border should almost always stay 1px. Converting it to 0.0625rem means the border might vanish at certain zoom levels or render inconsistently across browsers. Keep borders, outlines, and box-shadow offsets in pixels.
Rem is relative to the root. Em is relative to the parent element's font size. Using both in one component creates confusing compound scaling. Pick rem for consistency — save em for the rare cases where you actually want parent-relative sizing.
Technical Details
- Processing: 100% client-side — no data sent to any server
- Browser Support: Chrome, Firefox, Safari, Edge
- Conversion Modes: Single value, batch list, full CSS stylesheet
- Precision: Up to 4 decimal places (configurable rounding)
- Root Font Size: Adjustable from 1px to any custom value
Frequently Asked Questions
What is 1rem in pixels?
By default, 1rem equals 16px because that's the standard browser root font size. If you or your stylesheet changes the root font size — say to 10px using the 62.5% trick — then 1rem equals 10px instead. It always depends on what's set on the <html> element.
Why should I use rem instead of px in CSS?
Rem units respect the user's browser font size setting. If someone bumps their default text to 20px for readability, rem-based layouts scale with that choice. Pixel values don't budge. For accessibility alone, rem is the better pick for font sizes and spacing.
How do I convert px to rem manually?
Divide the pixel number by your root font size. With a 16px root: 24px ÷ 16 = 1.5rem. That's it. If your root is 10px, then 24px ÷ 10 = 2.4rem. The formula never changes — rem = px / rootFontSize.
What is the 62.5% root font size trick?
Setting html { font-size: 62.5%; } makes the root 10px (62.5% of the 16px default). Now the math is dead simple: 14px = 1.4rem, 20px = 2rem, 48px = 4.8rem. You just move the decimal point. Some teams love it. Others argue it creates more confusion than it solves — your call.
Is my CSS uploaded to a server when I use this tool?
No. The conversion happens entirely in your browser using JavaScript. Nothing leaves your machine — not the input, not the output. You can verify by disconnecting from the internet and the tool still works fine.