1. All tools
  2. PX to REM converter

How do I convert px to rem in CSS?

Divide the pixel value by the root font size: with the common default of 16 px, 24 px is 1.5 rem. Type a value into any box below and every other CSS unit (px, rem, em, pt, %, vw, vh, cm, mm, in) updates at once, using the root font size, parent font size and window size you set. You can also paste a whole CSS snippet and convert every number-with-unit in it.

Runs entirely in your browser · nothing is sent · no account

  1. Check the root font size (16 px is the usual browser default).
  2. Type a value into any unit box; all the others update.
  3. Copy a result, a table row, or convert a whole CSS snippet.
Browser default is 16 px (the html element).

Convert a value

Common sizes

Pixel sizes shown as rem at the root font size above.
pxrempt

Convert a list or CSS snippet

What this page can do

  • Converts between px, rem, em, pt, %, vw, vh, cm, mm and inches
  • Editable root font size, parent font size and window size
  • Table of common sizes from 10 to 72 px with one-click copy
  • Batch converts every number with a unit in pasted CSS
  • Leaves url(...), quoted strings, comments and unitless numbers alone

When to use this page

  • Moving a pixel-based design to rem so text follows the visitor’s font setting.
  • Checking what a Figma or print size means in CSS units.
  • Converting a block of existing CSS from px to rem in one go.

When to use something else

  • You need a build-time tool: a Sass or PostCSS plugin converts every file automatically on each build.
  • You need fluid type that scales with the screen: use clamp() and check the result in a real browser.
  • You need exact physical sizes on screen: CSS cm and inches are defined as 96 px per inch and do not match every display.

How it compares with other options

Most online px to rem converters assume a fixed 16 px root and convert one number at a time. This page lets you change the root and parent font sizes and the window size, shows all units at once, and can convert a whole CSS snippet while leaving everything else in it untouched. Editor extensions and build plugins are better for converting a whole project automatically; this page is for quick checks, learning how the units relate, and one-off conversions. Nothing here replaces testing in a real browser, because rem, em, vw and vh depend on the visitor’s settings and window.

Where your text goes

Nowhere. Everything is computed by your own browser. Nothing you type or paste is sent to a server, logged or stored — close the tab and it is gone. You can check it yourself: open your browser’s network panel — the page still loads its own code and any ads, but no request carries what you typed.

Questions about this tool

Why is 1rem equal to 16px?

Because 16 px is the default font size in most browsers, and 1 rem means “one root font size”. It is not fixed: if a visitor changes the default font size in their browser settings, or your CSS sets a different font-size on the html element, 1 rem changes with it. That is exactly why rem is good for accessibility, and why the root size on this page is editable.

What is the 62.5% root font-size trick?

Setting html { font-size: 62.5%; } makes the root font size 10 px when the browser default is 16 px, so 1 rem = 10 px and 14 px becomes 1.4 rem. It is easy to calculate, but you then need to set the body font size back (for example body { font-size: 1.6rem; }). To see the values, set the root font size field above to 10.

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 font size of the element’s parent (or of the element itself when used for font-size), so nested elements compound: 1.2em inside 1.2em is 1.44 times the base size. Set the parent font size above to see em results for your case.

Are cm, mm, inches and pt exact on screen?

They follow the CSS definition, not a physical ruler: 1 in = 96 px, 1 pt = 1/72 in, 1 cm = 96/2.54 px. A screen’s real pixel density varies, so 1 cm in CSS is not guaranteed to measure 1 cm on your display. For print layouts the values are consistent.

Other tools you may need