CompleteSEOTools
Home › Unit Converters › CSS Unit Converter

CSS unit converter

Convert a CSS length between pixels, rem, em, points, viewport units and more, using the sizes your page really has.

About CSS Unit Converter

Relative CSS units only make sense against a base. A rem is the root font size, an em is the parent font size, and vw and vh are a percentage of the window. So this converter asks for those numbers, with browser defaults filled in: a 16 px font and a 1280 by 720 window. It turns your value into pixels first, then into every other unit, and shows the full list in a table. Change the base values to match your own stylesheet or test a different screen size.

  • Turning a design in pixels into rem for an accessible stylesheet.
  • Checking what 5vw comes to on a given screen width.
  • Converting a print size in points or millimetres to CSS.
  • Working out an em value from a parent font size.

How to use CSS Unit Converter

1

Step 1

Type the value and choose the unit it is in and the unit you want.

2

Step 2

Set the root font size, the parent font size and the viewport size if yours differ.

3

Step 3

Read the result, or look in the table for the other units.

Good to know

  • The percent unit here means percent of the parent font size, which is what font-size uses. For widths, percent refers to the parent box, which cannot be known from a number alone.
  • CSS defines 1 inch as 96 px, so 1 pt is 1.3333 px and 12 pt is 16 px, whatever the real screen density is.
  • vh on phones can change as the address bar shows or hides. Test with the newer dvh unit if that matters for you.

Common questions

How do I convert px to rem?

Divide the pixels by the root font size. With the default 16 px, 24 px is 1.5 rem.

What is the difference between em and rem?

A rem is based on the root element font size and stays the same everywhere. An em is based on the font size of the parent, so nested elements can compound.

Why does vw give different results on different screens?

Because 1vw is one percent of the window width. At 1280 px wide it is 12.8 px, and at 390 px wide it is 3.9 px.