Format Code Now
/

REM to PX Converter

WM-04

Enter a value such as 1.5rem or 24px and get px, rem, em and pt for the root font size you choose. The default root size is 16 px, the usual browser default.

Runs in your browser. Nothing is uploaded.

Values, one per line

Converted

How to use it

  1. Pick the root font size your page uses (16 px unless you changed the html font size).
  2. Type one value per line, such as 1.5rem, 24px or 12pt. A bare number uses the unit under "Unit when none is typed".
  3. Choose All units or one target unit.
  4. Press Convert and copy the result.

How rem relates to pixels

One rem equals the font size of the root html element. With the default 16 px, 1.5rem is 24 px and 0.875rem is 14 px. If your stylesheet sets html to 62.5 percent, the root is 10 px, which is not in the list, so scale the answer yourself: 1.6rem is 16 px there. Set the root size in the list to match your own page. The conversion is a straight multiplication, with no rounding until the last digit shown.

About em and points

The em row uses the same size as the root, so it matches rem only when the element is not inside a parent with a different font size. An em inside nested elements multiplies with each level, and no converter can know that from a single number. A point is 1/72 of an inch, and a CSS pixel is 1/96 of an inch, so 1 pt is 1.3333 px and 12 pt is exactly 16 px.

What this does not do

It does not read your CSS, media queries or the font size a visitor sets in their browser. A person who raises their default text size will see different pixel values than this table shows, which is the reason to size type in rem in the first place. It also does not convert percentages, vw or vh, which depend on the window.

Error messages and what to do

MessageWhat it meansFix
Line 1: unknown unit "foo". Known units: px, rem, em, pt.The text after the number is not a unit this tool knows, so it cannot tell what the number measures.Use one of the units named in the message, or its full name, such as the spelled-out unit.
Line 1: could not find a number at the start of "abc". Write a value such as 12.5 km, or just 12.5.The line does not start with a number, so there is nothing to convert.Start each line with a value such as 12.5, with the unit after it if you want one.

Questions people ask

How many px is 1 rem?

With the default root font size, 1 rem is 16 px. If the root is set to another size, 1 rem is that many pixels. Choose the root size in the list and type 1rem to see it.

How do I convert px to rem?

Divide the pixel value by the root font size. At 16 px, 24 px is 1.5 rem. Type 24px and the rem row shows 1.5.

Is rem the same as em?

Not in general. Rem is relative to the root element, while em is relative to the parent element font size. They give the same number only when the parent font size equals the root. The em row here assumes that.

What is 14px in rem?

At the default 16 px root, 14 px is 0.875 rem. At an 18 px root it is 0.7778 rem, rounded. Change the root size and the answer follows.

How many px is 12pt?

Exactly 16 px, because CSS defines 96 pixels per inch and 72 points per inch, which makes 1 pt equal to 4/3 px. This does not depend on the root font size.

Should I use rem or px for font sizes?

Rem follows the text size a visitor sets in their browser, while px stays fixed. Many developers size text in rem for that reason and keep px for borders and hairlines. Either is valid CSS.

About this tool

Works from the root font size you pick (browsers default to 16 px). One rem is that many pixels. The em row assumes the em is the same size as the root, which is true only when the element is not inside a parent with a different font size; em inside nested elements compounds and cannot be known from a number alone. One point is 4/3 of a CSS pixel (96 px per inch, 72 pt per inch). The tool does not read your stylesheet, user zoom or the browser text-size setting, so a visitor who changes their default size will see different pixel results.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.