Pixels, rem, em, points and millimetres

Enter a value in any unit and see it in all the others. Set the root font size to match your stylesheet, and use the table of common sizes as a reference.

  • Free
  • No sign-up
  • Runs in your browser
px-to-rem-converter

Fill in the values above to see the result.

100% private — the calculation is done in your browser and nothing is sent to any server.

How it works

Enter a value and a unit

Pixels, rem, em, points, picas, millimetres, centimetres or inches.

Set the root font size

16 px is the browser default. Change it if your CSS sets another size.

Copy the conversion you need

Every unit is shown at once.

CSS units, side by side

Web design mixes several units, and moving between them is a constant chore: a design hands you sizes in pixels, the stylesheet uses rem, a print stylesheet wants points or millimetres, and someone asks how big something is in centimetres. This converter shows any value in all of them at once, so you do not need to work out the conversion each time.

What each unit is

  • px is the CSS pixel, a reference unit that is not the same as a physical screen dot. By definition, 96 CSS pixels make one inch.
  • rem is relative to the root font size, the size set on the html element. With the browser default of 16 px, 1 rem is 16 px, so 24 px is 1.5 rem.
  • em is relative to the font size of the element it is used on, or of its parent. When the parent uses the root size, em and rem give the same result; inside nested elements with different sizes they differ, which is why em compounds.
  • pt is the point, 1/72 of an inch, common in print and word processors. 12 pt is 16 px.
  • pc is the pica, 12 points or 16 px. mm, cm and in are physical lengths, fixed in CSS to 96 pixels per inch.

Why rem is worth using

Sizing text and spacing in rem lets your layout follow the reader's own font size setting. Someone who has increased the default text size in their browser gets a proportionally larger page, while sizes fixed in pixels ignore the preference. This is a real accessibility benefit. The root size field lets you convert for stylesheets that change the base, such as a 62.5% root that makes 1 rem equal to 10 px.

Print and screen

The conversions to points, millimetres and inches follow the CSS definition, in which an inch is 96 pixels. On a real screen the physical size of a pixel varies with the device, so a 96-pixel line is not always exactly one inch on screen. In print styles the conversion is exact, which is where these units are most useful.

What it does not do

It does not convert viewport units (vw, vh) or percentages, which depend on the size of the window or of the parent, and it does not know the device pixel ratio. To work out the shape of an image or a screen, use the aspect ratio calculator.

Frequently asked questions

How do I convert px to rem?
Divide the pixels by the root font size. With the default 16 px, 24 px is 24 ÷ 16 = 1.5 rem.
What is the difference between rem and em?
rem is relative to the root font size, always the same. em is relative to the font size of the element or its parent, so it can compound in nested elements.
How many pixels is 1 rem?
16 px by default, since browsers use a 16 px root font size. It changes if the page or the user sets another size.
How many pixels are 12 pt?
16 px. One point is 1/72 of an inch and one pixel 1/96 of an inch, so 1 pt is 1.333 px.
How many mm is a pixel?
In CSS, one pixel is 0.2646 mm, since 96 pixels make an inch of 25.4 mm. Real screens vary.
Is my data sent anywhere?
No. The calculation is done in your browser.