Muhammad Aftab
  1. Home /
  2. Free Tools /
  3. HTML Tools /
  4. CSS Unit Converter

HTML Tools

CSS Unit Converter

Convert between CSS units — px, em, rem, pt, pc, cm, mm, vw, vh and % — with accurate context-aware conversion. Set your root font size, viewport dimensions and parent element size to get correct relative unit values.

About the CSS Unit Converter

Convert between px, em, rem, pt, pc, cm, mm, vw, vh and % with the context values that make the conversion accurate. Set your root font size (usually 16px), viewport dimensions and parent element size.

em is relative to the parent element's font size. rem is relative to the root <html> font size. vw/vh are percentages of the viewport width/height.

1pt = 1/72 inch = 1.333px at 96 dpi. 1pc = 12pt = 16px. 1cm = 37.795px at 96 dpi.

Frequently asked questions

What is the difference between em and rem?

em is relative to the font size of the parent element, which can compound in nested elements. rem is always relative to the root &lt;html&gt; element font size — usually 16px — making it more predictable for layout.

How are vw and vh calculated?

1vw equals 1% of the viewport width, and 1vh equals 1% of the viewport height. Set the viewport dimensions in the converter to match your target breakpoint for an accurate result.