CSS Unit Converter

Convert a CSS length between px, rem, em, pt, pc, in, cm and mm and see every equivalent at once. You set the root font size used for rem and the parent font size used for em, and can start from common presets such as 16px body text or 12pt print text. All math runs in your browser.

How to use

  1. Type a number in Value and pick its Unit, or click one of the Common presets such as 16px Body text or 12pt Print body.
  2. Set Root font size (px) for rem and Parent font size (px) for em; both start at 16.
  3. Read the Equivalents table, where the row of the unit you entered is marked Source.
  4. Click Copy to copy a value with its unit, or Use as input to make that row the new starting value. Reset goes back to 16px.

Example

Input

Value: 1.5 · Unit: rem
Root font size: 16px · Parent font size: 20px

Output

px: 24
rem: 1.5
em: 1.2
pt: 18
pc: 1.5
in: 0.25
cm: 0.635
mm: 6.35

Frequently asked questions

Why is 1cm shown as 37.7953px?

The tool uses the CSS reference of 96 px per inch, so 1in = 96px, 1cm = 96 ÷ 2.54 px, 1pt = 1/72in and 1pc = 12pt. On screen, CSS inches and centimetres are not guaranteed to match a physical ruler.

What is the difference between the root and parent font size?

rem is always relative to the root html font size, and em is relative to the font size of the element's parent, so the parent field only changes the em row. If either field is empty, zero or negative, the tool uses 16px instead.

How are the results rounded?

Values of 100 or more are shown with up to 2 decimal places, values from 1 to 100 with up to 4, and smaller values with up to 6, with trailing zeros removed. Copy copies exactly the value shown plus its unit, for example 0.635cm.

Can it convert vw, vh or percentages?

No. These depend on the viewport or the containing element, so the tool only converts px, rem, em, pt, pc, in, cm and mm.

Related tools