CSS Unit Converter

Convert px, rem, em, vw, vh, pt and % with configurable base sizes.

The CSS Unit Converter turns a value in one CSS unit into all the others at once: px, rem, em, pt, pc, in, cm, mm, vw, vh, vmin, vmax and percent. You can set the base font size and the viewport size that relative units depend on. It is useful when converting a design in points or pixels into responsive CSS.

What are CSS units?

CSS has absolute and relative length units. Absolute units have a fixed ratio to the CSS pixel: 1 inch is 96px, 1 point is 1/72 inch, 1 pica is 12 points (16px), and centimetres and millimetres follow from the inch. Relative units depend on context. rem is relative to the root element font size, em to the current element font size, and vw, vh, vmin and vmax are 1 percent of the viewport width, height, smaller side or larger side. Because relative units depend on a base value, converting them needs assumptions. Browsers default to a 16px font size, which is why 1rem is usually 16px. The CSS pixel is also not a physical device pixel, so inches and centimetres are CSS measures, not exact screen sizes.

How to use CSS Unit Converter

  1. Enter a value Type a number in Value.
  2. Choose the From unit Pick the unit your value is in from From unit.
  3. Set the context Adjust Base font (px), Viewport width (px) and Viewport height (px) if they differ from the defaults.
  4. Copy a result Click the copy button next to the unit you need.

Frequently asked questions

How many pixels is 1rem?

It equals the root font size, 16px by default in browsers. Set Base font (px) if you changed it.

How many pixels are in an inch, point and pica?

1in is 96px, 1pt is 1.3333px (96/72) and 1pc is 16px in CSS.

Are cm and mm exact on screen?

They are exact in CSS terms (1in is 2.54cm) but a CSS inch does not match a physical inch on every screen.

What do vh and vw mean?

1vw is 1 percent of the viewport width and 1vh is 1 percent of its height. vmin and vmax use the smaller and larger of the two.

Why does percent equal font size here?

Percent is treated as a percentage of the base font size, so 100% equals the base font.

Is anything sent to a server?

No. All the calculations happen in the page.