CSS Unit Converter
Beta: this tool hasn't been fully reviewed yet. Double-check results before relying on them.
Inputs
Pick its CSS unit on the right.
The html element's font size; browsers default to 16.
For em and %.
For vw, vmin and vmax.
For vh, vmin and vmax.
Results
| Unit | Value |
|---|---|
| Pixels (px) | — |
| Root em (rem) | — |
| Em (em) | — |
| Percent of parent font (%) | — |
| Points (pt) | — |
| Picas (pc) | — |
| Inches (in) | — |
| Centimeters (cm) | — |
| Millimeters (mm) | — |
| Viewport width (vw) | — |
| Viewport height (vh) | — |
| Smaller viewport side (vmin) | — |
| Larger viewport side (vmax) | — |
Your input is too long to share as a link, so the page address no longer includes it.
CSS has absolute units (px, pt, in, cm) with fixed ratios, since 1 in is always 96 px, and relative units that depend on context: rem on the root font size, em and % on the parent’s font size, and vw, vh, vmin and vmax on the browser window. Give the context and every unit converts.
How to use it
- Type a length and pick its unit.
- Adjust the root and parent font size and the viewport if yours differ from the defaults.
- Read or copy the value in every other unit.
Examples: with the default 16 px root, 24px is 1.5rem and 18pt. 1in is always 96px. On a 1,440 px wide window, 10vw is 144px.
Questions and answers
Should I use px or rem for font sizes?
rem, usually: it scales when people change their browser’s default font size for readability, while px does not. Keep px for things that shouldn’t scale, like hairline borders.
What is the difference between em and rem?
rem is relative to the root (html) font size, the same everywhere on the page. em is relative to the current element’s parent font size, so it compounds when elements are nested.
Is a CSS inch a real inch?
Only on paper. On screens, CSS defines 1 in as 96 px and 1 px as a viewing angle, so physical sizes depend on the display.
Link with pre-filled values
Add # and these parameters to the end of this page's address to open the tool with values already filled in.
| Parameter | What it sets |
|---|---|
value | The length to convert. |
from | Its unit: px, rem, em, pct (%), pt, pc, in, cm, mm, vw, vh, vmin or vmax. |
root | Root font size in px. |
parent | Parent font size in px (for em and %). |
vw | Viewport width in px. |
vh | Viewport height in px. |
Example: https://toolabelle.com/css-unit-converter/#value=1.5&from=rem&root=16&parent=20&vw=1440&vh=900