Skip to content
NexUnit home
EnglishEspañol

CSS Unit Converter (px, em, rem, vw, pt)

Convert CSS lengths between px, em, rem, %, vw, vh, pt, pc, in, cm, mm and Q using your font sizes, viewport and screen DPI.

px

html { font-size }

px

For em and %

px/in

CSS px per real inch

px
px

In pixels

16px

rem
1rem
em
1em
pt
12pt
vw
1.1111vw
On a 96 DPI screen
4.233 mm (0.1667 in)

Assumes a 16px root font, a 16px element font and a 1440 × 900px viewport. CSS absolute units use 1in = 96px; the physical size uses your 96 px per inch.

The same length in every CSS unit

UnitValue
px16
rem1
em1
% (of font size)100
vw1.1111
vh1.7778
vmin1.7778
vmax1.1111
pt12
pc1
in0.1667
cm0.4233
mm4.2333
Q (quarter-mm)16.9333

Show the work

  1. In rem

    rem = px ÷ root font size

    16 ÷ 16 = 1rem

  2. In em

    em = px ÷ element font size

    16 ÷ 16 = 1em

  3. In pt

    pt = px ÷ (96 ÷ 72)

    16 ÷ (96 ÷ 72) = 12pt

  4. In vw

    vw = px ÷ (viewport width ÷ 100)

    16 ÷ (1440 ÷ 100) = 1.1111vw

  5. In pixels (the value you entered)

    16px

How it works

CSS fixes 1in = 96px = 72pt = 6pc = 2.54cm and 1Q = 0.25mm. 1em (and 100%) = the element's font size; 1rem = the root font size; 1vw/1vh = 1% of the viewport width/height; vmin/vmax use the smaller/larger side.

Absolute units use CSS's anchor (1 in = 96 px, CSS Values and Units Level 4 §6.2), so a CSS inch is not a physical inch on most screens. The 'on your screen' size uses the DPI you enter. % is taken as a percentage of the font size (as for font-size).

Questions

How does the CSS unit converter work?
CSS fixes 1in = 96px = 72pt = 6pc = 2.54cm and 1Q = 0.25mm. 1em (and 100%) = the element's font size; 1rem = the root font size; 1vw/1vh = 1% of the viewport width/height; vmin/vmax use the smaller/larger side.
What does it assume?
Absolute units use CSS's anchor (1 in = 96 px, CSS Values and Units Level 4 §6.2), so a CSS inch is not a physical inch on most screens. The 'on your screen' size uses the DPI you enter. % is taken as a percentage of the font size (as for font-size).
How many px is 1rem?
The root font size — 16 px in every browser by default — so 1rem = 16px = 12pt unless the page changes html { font-size }.
Why doesn't 1 CSS inch measure an inch on my screen?
CSS defines 1in as 96 px. Real screens have other pixel densities, so enter your DPI to see the physical size.

Want this on your site? Embed the css unit converter (px, em, rem, vw, pt).