Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Pixel to REM Calculator

Convert px values to rem units based on your root font size — single values, batch lists, or full CSS

Your files never leave your browser
px
↔
Enter a value to convert
Formula: rem = px ÷ root font size
Input (px values, one per line)
Output (rem values)0 values
Input CSS (with px values)
Output CSS (with rem values)0 replacements
Ready·Root: 16px

Quick Reference Table

Common px to rem conversions based on current root font size (16px)

PixelsREMPixelsREMPixelsREM

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

Enter PX Value
→
Divide by Root Size
→
Get REM Result

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.

INPUT
32px (root: 16px)
OUTPUT
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.

INPUT
4px 8px 12px 16px 24px 32px 48px 64px
OUTPUT
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.

INPUT
.card { padding: 24px 16px; font-size: 14px; border-radius: 8px; margin-bottom: 32px; }
OUTPUT
.card { padding: 1.5rem 1rem; font-size: 0.875rem; border-radius: 0.5rem; margin-bottom: 2rem; }

Who Uses This

👨‍💻 Frontend Developers

Converting pixel-based designs to rem-based CSS for accessible, scalable layouts.

🎨 UI Designers

Translating Figma or Sketch specs (always in px) into developer-ready rem values.

📱 Responsive Web Builders

Making sure layouts scale properly across screen sizes and user font preferences.

♿ Accessibility Engineers

Switching from px to rem so text and spacing respect browser zoom and font size settings.

Common Mistakes

Forgetting to match the root font size

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.

Converting border widths to rem

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.

Mixing rem and em in the same component

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

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.

Share: