CSS Unit Converter

Convert a length between the fixed CSS units px, in, cm, mm, Q, pt and pc using exact factors.

How it works

CSS defines one inch as 96 pixels and also as 2.54 centimetres. The other fixed units follow from that: a millimetre is a tenth of a centimetre, a quarter millimetre (Q) is 0.25 millimetres, a point is 1/72 of an inch and a pica is 12 points, or 1/6 of an inch. The conversions use those exact fractions, so a length converted and then converted back returns exactly the value you started with. The inch here is the CSS inch, which on a screen does not have to match a physical inch.

Units such as em, rem, ch, ex, lh, vw, vh, vmin, vmax and % are not offered. Their size depends on a font size, the size of the screen or a parent element, so there is no fixed conversion. For example, 1rem equals 16px only when the root font size is 16px, which is common but not guaranteed.

What this result means

The result is your length converted between fixed CSS units, using exact factors.

Examples

  • 1 in: 96 px, 2.54 cm and 72 pt
  • 16 px: 12 pt, because 1 pt is 4/3 of a CSS pixel.

Common mistakes

  • Treating a CSS pixel as a physical size. In CSS, 1 in is defined as 96 px, so a pixel is a fixed fraction of an inch in the stylesheet, not the size of a dot on your screen.

Assumptions and limitations

  • Units that depend on context, such as em, rem, vw and %, are not converted.

Analytics only runs if you choose to allow it below. Advertising and affiliate tracking are not currently active on Numerila. Your preferences are saved in this browser, but these settings do not activate either service.