Dev & Web

CSS Unit Converter

Convert between px, rem, em, pt, cm, mm, in, vw, and vh instantly. Set your root and parent font sizes for accurate rem and em calculations.

Value
From unit
Context settings
Root font size (for rem)
Parent font size (for em)
Viewport width (for vw)
Viewport height (for vh)
UnitValueDescription
px16Base pixel unit
rem1Root em (relative to root font size)
em1Relative to parent font size
pt12Points (1pt = 1.333px)
pc1Picas (1pc = 16px)
cm0.423336Centimeters
mm4.2334Millimeters
in0.166667Inches
vw1.1111Viewport width units
vh1.7778Viewport height units

How it works

All conversions go through pixels as a common base. Enter a value and source unit, and the tool converts to every other CSS unit simultaneously using your context settings for relative units like rem, em, vw, and vh.

Frequently asked questions

What is the difference between px and rem?

px is an absolute unit - 1px equals one device pixel (at 1x zoom). rem is relative to the root font size. If root font size is 16px, 1rem = 16px. rem scales with user accessibility settings.

When should I use em vs rem?

Use em for spacing that should scale with its parent element (e.g. padding inside a component). Use rem for global sizes like base font sizes and layout spacing that should scale consistently.

What is the px to pt conversion?

1px = 0.75pt at 96 DPI (the web standard). So 16px = 12pt. Points are commonly used in print design and some CSS for font sizes.

What are viewport units (vw, vh)?

vw is 1% of the viewport width, vh is 1% of the viewport height. They are useful for responsive layouts: 100vw = full browser width, 50vh = half the browser height.

Related tools