Skip to content

CSS unit converter

Convert a value between px, rem, em, %, vw, vh, pt, cm, mm and inches, with the font and screen size of your choice. Includes a px to rem table.

  • Free
  • No sign-up
  • No file uploaded
  • Windows, Mac, Android, iPhone

Loading the tool…

About this tool

Convert any CSS value to every other unit at once: pixels, rem, em, percentages, vw, vh, vmin, vmax, points, picas, inches, centimeters, millimeters and quarter-millimeters. The context (page and parent font size, screen and parent size) is adjustable, and a table gives common px/rem/pt equivalents.

When to use it

Convert a mockup to rem

Mockups give sizes in pixels; converting them to rem makes the site respect the visitor's chosen font size.

Prepare a print stylesheet

Points and millimeters are print units: convert your px for a faithful printed document.

Understand a vw value

How much is 5vw on a 1440 px screen? Set the screen width and read the size in pixels.

How to use

  1. Enter a value and its unit.
  2. Read the conversion in every other unit.
  3. Adjust the context (font size, screen) if needed, then copy.

How it works

Every conversion goes through the CSS pixel. Absolute units follow the ratios fixed by CSS (1 in = 96 px = 2.54 cm = 72 pt = 6 pc); relative units use the context sizes.

Results are rounded to four decimals, which is plenty for any CSS value. Your context settings are kept in your browser.

Tips for best results

  • Use rem for font sizes and spacing: the site adapts to the visitor's font setting.
  • Keep px for thin borders and shadows.
  • Avoid em for nested font sizes: the effect compounds.
  • vw alone for a font size blocks zoom: combine it with rem inside clamp().

Common problems and fixes

The rem result isn't what I expected

Your project's root font size may not be 16 px: set it in the context.

% values don't match

In CSS, % doesn't always refer to the parent width (height, font size…). The calculation assumes width.

On-screen cm aren't 1 cm

That's normal: on screen, CSS fixes 1 cm to 37.8 px, whatever the real pixel size.

Frequently asked questions

How much is 16 px in rem?

1 rem with browsers' default font size (16 px). The formula is: rem = px ÷ root font size.

What's the difference between rem and em?

rem relates to the page font size (html element), em to the parent element's. em compounds in nested elements, rem doesn't.

Why do % and vw results depend on the context?

These units are relative: % to the parent width, vw and vh to the screen size. Set these sizes in the calculation context.

Are CSS cm and inches real?

Not on screen: CSS fixes 1 inch = 96 px. They are accurate when printing.

Related searches

Still stuck?

Ask on the forum: the category, the tool, your device sheet and the test result will be filled in for you.