Skip to content
hateitall

PX to REM Converter

Convert single values or a whole stylesheet from px to rem using your project's real root size.

Processed locallyIn: Number, CSSOut: Number, CSS

Loading tool…

How to use px to rem converter

  1. Set the root font size (16 by default) and, for em, the parent font size.

  2. Type a value in px, rem or em; the other two update.

  3. Use the table of common sizes as a quick reference.

  4. Paste a stylesheet to convert every px length to rem, then copy or download it.

What this tool does

  • Converts in all directions between px, rem and em.
  • Rewrites a stylesheet while skipping comments, strings, url() and, by choice, media query conditions.
  • Can keep hairline values under 2px in px so 1px borders stay crisp.
  • Counts how many values were converted and how many were left alone.

How the result is verified

Multiply any rem result by the root size to get the px back. The bulk output reports its counts, so you can compare them with how many px values you expected.

Frequently asked questions

What is the difference between rem and em?

rem is relative to the root html font size, so it is the same everywhere on the page. em is relative to the parent's font size, so it compounds when elements are nested.

Why leave media queries in px?

rem in a media query uses the browser's default font size, not the root size you set in CSS. If your root is not 16px, converting media queries with it gives the wrong breakpoints.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

Fluid clamp() between two viewport widths, verified at real widths

Number→ CSSLight on device

Spacing tokens from a base unit, ratio or list as CSS, Tailwind or JSON

Number→ CSS custom propertiesLight on device

Modular type scale with common ratios, fluid option and CSS variables

Number→ CSS custom propertiesLight on device

Beautify minified CSS with clean indentation, selectors and media queries

CSS · Text→ CSSLight on device