1. Home
  2. Design tools
  3. CSS Unit Converter

CSS Unit Converter

Enter one length and see it in all fourteen CSS units, based on your own root size, parent size and viewport.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use CSS Unit Converter

  1. Enter a value and its unit.
  2. Set the root font size, parent size and viewport.
  3. Copy any converted value.

Features

  • Fourteen units in one table
  • Absolute units follow the CSS definitions
  • rem, em and % from your font sizes
  • vw, vh, vmin and vmax from your viewport
  • Copy button on every row
  • Explanation of each unit

Supported formats

Input

  • A value and unit

You get

  • Values in 14 units

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the CSS Unit Converter is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • em and % depend on the parent font size you enter.
  • Physical units on screen match real lengths only if the display reports its size honestly.

Guide

CSS units compared: absolute, font-relative and viewport lengths

CSS has more than a dozen length units, and each one answers a different question. Some are fixed against each other like inches and points, some depend on the font and some on the size of the browser window. Converting between them is simple when you know what the context is, and a common source of mistakes when you do not. This converter fixes the context in four boxes and shows your value in every unit at once.

Absolute units

The absolute family is tied together by definition. One inch is 96 pixels, 72 points, 6 picas, 2.54 centimetres, 25.4 millimetres and 101.6 quarter-millimetres. A CSS pixel is therefore 1/96 inch, but it is a reference unit: browsers scale it for high-density screens and zoom, so one CSS pixel is rarely one device pixel. Points and picas come from print, and Q, the quarter-millimetre, is rare but valid. The conversion between these units never changes.

Relative units

rem is the root element’s font size, usually 16 pixels. em is the font size of the current element, which for font-size itself means the parent’s. % on a font-size is a share of the parent size. The viewport units depend on the window: vw and vh are one percent of its width and height, vmin and vmax one percent of the smaller or larger side. A value in these units is the same length as a value in pixels only for the settings you chose, so the converter asks for them.

A worked example

Press Sample: 1.5 rem with a root size of 16, a parent size of 16 and a 1440 by 900 viewport. The table shows 24px, 1.5rem, 1.5em, 18pt, 1.5pc, 0.25in, 0.635cm, 6.35mm, 25.4Q, 1.6667vw, 2.6667vh, 2.6667vmin, 1.6667vmax and 150%. Read the viewport figures this way: 24 pixels is 24 ÷ 1440 × 100 = 1.6667% of the width and 24 ÷ 900 × 100 = 2.6667% of the height. The smaller side is the height, so vmin equals vh, and the larger side is the width, so vmax equals vw.

Other conversions

Enter 100 and choose vw and the table says 1440px for this viewport. Twelve points are 16 pixels, the usual body size. Ten millimetres is about 37.8 pixels. Change the root size to 10, a habit from the days of the 62.5% trick, and 1.5rem becomes 15px instead of 24px. Change the parent size and the em and % rows move while rem does not.

Choosing units in practice

Use rem for font sizes and most spacing so that readers who raise the browser’s text size get larger layouts. Use em for components that must scale with their own text. Use px for hairlines such as 1 pixel borders. Use viewport units for sections that should fill the screen, and combine them with min() and clamp() to avoid extremes. Avoid cm, mm and in for screen layouts; they are meant for print stylesheets.

Edge cases

Mobile browsers have a dynamic viewport that changes as the address bar slides away, so vh can be larger than the visible area; newer dvh and svh units address this and are not in the table. Percentages mean different things on different properties: of the parent width for width, of the parent height for height, of the font size for font-size. The converter’s percentage row is the font-size case only.

Limits

The converter handles lengths, not angles, times or resolutions. It does not read your page, so the context numbers are yours to supply. Very small viewports and root sizes are limited to sensible ranges. Everything is calculated in your browser.

Checked against the current version of the CSS Unit Converter on .

Frequently asked questions

Is 1 cm in CSS exactly one centimetre on my screen?

Only by definition. CSS fixes 1 cm at 96 ÷ 2.54 pixels, but a CSS pixel is a reference pixel and not a physical dot, and most screens do not report their true size. For real measurements on screen use the screen ruler and calibrate it.

When should I use em instead of rem?

Use rem for sizes that should follow the root setting, such as font sizes and layout spacing. Use em when a size should scale with the element own font size, for example the padding of a button that grows with its text.

Is a CSS pixel a screen pixel?

No. A CSS pixel is defined as 1/96 inch, and the browser maps it to device pixels. On a high-density screen one CSS pixel can be several device pixels.

What is the difference between rem and em?

rem is relative to the root element’s font size, so it is predictable. em is relative to the parent’s font size, so nested elements compound.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.