Skip to content
1440px

CSS Unit Converter

Convert between every CSS length unit, with the exact ratios the specification defines.

Converter

All converters

CSS units reference

CSS length units and their fixed pixel relationships
UnitNameTypeIn pixelsWhat it is
pxPixelabsolute1 pxThe CSS reference pixel. Not a physical device pixel — on a 3× display one CSS px covers nine device pixels.
remRoot emrelative= root / parent font sizeRelative to the root element's font size. The unit of choice for anything that should scale with the user's browser setting.
emEmrelative= root / parent font sizeRelative to the font size of the current element, which makes it compound when nested.
ptPointabsolute1.33333 px1/72 inch. The unit print and native macOS/iOS tooling speak.
pcPicaabsolute16 px12 points, 1/6 inch. Typesetting heritage.
inInchabsolute96 pxFixed at exactly 96 CSS px.
cmCentimetreabsolute37.79528 px1cm = 96/2.54 ≈ 37.795 px.
mmMillimetreabsolute3.77953 px1mm = 96/25.4 ≈ 3.7795 px.
QQuarter-mmabsolute0.94488 pxA quarter of a millimetre. Rare, but part of the spec.

Questions

Which CSS unit should I use?

rem for type, spacing and layout — it respects the user's browser font-size setting. px for hairlines and anything that must not scale. Avoid pt, mm and in on screen entirely; they are print units that CSS only supports for print stylesheets.

Why is 1 inch always 96 pixels in CSS?

Because the spec pins it there. It is a reference relationship, not a physical measurement — it lets absolute units stay self-consistent across wildly different displays. A CSS inch on a 460 PPI phone is nowhere near an inch of physical glass.

What is the difference between rem and em?

rem is always relative to the root element. em is relative to the current element's own font size, so nested elements compound: 0.9em inside 0.9em is 0.81 of the original. rem avoids that entirely, which is why it is the safer default.

Print & physical sizes

Converting for print is a different calculation — it depends on DPI, not on the CSS 96px inch. See print sizes in pixels and the DPI calculator.