Skip to content
AZ Tools

CSS Unit Converter

Convert between px, rem, em, pt, vw, vh, and % using your own base font size and viewport.

Base sizes (root, parent, viewport)

All units

  • px16.000
  • rem1
  • em1
  • pt12.000
  • vw1.1111
  • vh1.7778
  • %100.00

How to use

  1. Type a value and pick a source unit (px, rem, em, pt, vw, vh, %).
  2. All other units update instantly.
  3. Expand the 'base sizes' panel to change root / parent font size or viewport.
  4. Copy the formatted value next to any unit.

About this tool

Show

Type a value in any CSS unit and see it converted to all the others at once, with the root font size, the parent font size and the viewport dimensions all under your control so the numbers match the page you are actually building. The distinction worth internalising is between rem and em: rem always resolves against the root element, so it stays predictable however deeply an element is nested, while em resolves against the parent and therefore compounds — three levels of 0.9em leave you at about 0.73 of the original, which is where mysteriously shrinking text usually comes from. It is also why sizing in rem respects a reader who has raised their browser's default font size, and sizing in px quietly ignores them.

Frequently asked questions

Why are rem and em different?

rem is relative to the document root (html font-size, default 16 px). em is relative to the parent element. They're equal only when the parent itself uses the root size.

Why does pt = 1.333 px?

CSS defines 1 in = 96 px and 1 pt = 1/72 in, so 1 pt = 96/72 ≈ 1.333 px.

Are vw / vh accurate?

They use the viewport width and height you enter in the base-sizes panel. Default 1440 × 900 matches a common desktop; change them to match your design canvas.

What about %?

% is computed against the parent font size (treated the same as em for typography). For other CSS properties, % depends on the property's containing block.

Should I size text in rem or px?

rem, almost always. A reader who has raised their browser's default font size gets larger text with rem and is ignored entirely by px, which is a real accessibility failure rather than a style preference. Keep px for things that genuinely should not scale, like a hairline border.

Why did my nested text keep shrinking?

Because em compounds. Each level resolves against its parent, so three nested elements at 0.9em land at roughly 0.73 of the original — 0.9 × 0.9 × 0.9. rem cannot do this, since it always resolves against the root no matter how deep the element sits.

Related tools