CSS Unit Converter

Convert a CSS length across every common unit at once. Enter a value in px, rem, em, %, vw, vh, pt or cm, set the root font size, parent font size and viewport to match your project, and click any result to copy it. It complements the dedicated px-to-rem and Tailwind converters.

What each unit depends on

Unit1 unit equals
remRoot font size (16px default)
emParent font size
%Reference length
vw / vh1% of viewport width / height
pt1.333px (1/72 in)
pc16px (12pt)
in96px
cm37.795px
mm3.7795px
Tailwind step0.25rem (4px)

When to use it

  1. Turn a designer's px values into rem.
  2. Work out vw values for fluid layouts.
  3. Convert print sizes (pt, mm) for print stylesheets.
  4. Find the Tailwind spacing class for a px value.

How to Use

  1. Enter a value and pick its unit.
  2. Adjust the root, parent and viewport sizes if needed.
  3. Click a result to copy it.

Features

  1. 14 units at once
  2. Editable rem, em, % and viewport context
  3. vmin and vmax
  4. Print units (pt, pc, in, cm, mm)
  5. Tailwind spacing
  6. Click to copy

FAQs

Why do I set a root size?

rem is relative to the root (html) font size, which is 16px unless your CSS changes it.

What's the difference between em and rem?

em uses the parent element's font size and compounds when nested; rem always uses the root.

Where do vw and vh come from?

From the viewport size, which defaults to your current browser window and can be edited.

Is 1cm really 1cm on my screen?

Not necessarily. CSS fixes 1in at 96px, so absolute units are exact in print but depend on screen density on displays.

Does it support Tailwind?

Yes, using Tailwind's default 0.25rem spacing step.

Technical Details

Every value is first turned into CSS pixels, then divided by the pixel size of each target unit: - **rem:** the root font size (16px by default). - **em:** the parent element's font size. - **%:** a reference length you set, such as the containing block's width. - **vw / vh:** 1% of the viewport width or height, defaulting to this browser window. vmin and vmax use the smaller or larger of the two. - **Absolute units:** fixed by the CSS specification: 1in = 96px, 1pt = 1/72in, 1pc = 12pt, 1cm = 96/2.54px, 1mm = 1/10cm. They match real sizes on paper, not necessarily on a screen. - **Tailwind:** its default spacing step of 0.25rem, so p-4 = 1rem. Results are rounded to four decimals. A unit whose context is zero shows a dash instead of dividing by zero.

Web & CSS Tools

Web & CSS Tools

  • Layout Grid Calculator
  • Design Tokens Converter
  • SVG Sprite Builder
  • Font Subsetter and WOFF2 Converter
  • Viewport Meta Tag Generator
  • Web App Manifest Generator
  • CSS Button Generator
  • CSS Text Shadow Generator