CSS Unit Converter — px, rem, em, %, pt, vw
Convert CSS lengths between px, rem, em, %, pt and vw — with your own root and parent sizes.
CSS has several units that look interchangeable and are not. Pixels are absolute on the screen; rem is relative to the root element’s font size; em and font-size percentages are relative to the parent; pt belongs to print (1 pt = 1/72 inch, exactly 4/3 px); and vw is a percentage of the viewport width. Converting between them without the right context number — most pages just assume 16 px for everything — is how a “1.5rem” ends up quietly wrong on any site whose root size is not 16.
How to use
- Enter the value and pick the unit it is in, and the unit you want.
- Set the context the conversion depends on: root font size for rem, parent font size for em and %, viewport width for vw.
- The result updates as you type, and the table underneath shows the same length in every unit at once.
- Use Swap to convert back with the same context.
About this tool
So this converter asks for the context: your root font size, your parent font size and your viewport width, all editable. Change any of them and every figure recalculates, which makes it a fair way to check what a design token actually means inside a nested component (where em compounds) versus at the top level (where rem does not).
One scope note: the % here is the font-size percentage — a percentage of the parent element’s font size, the way % behaves on the font-size property. Percentages on width, margin and padding refer to other bases (usually the containing block’s width) and are not what this tool computes. Everything runs in your browser.
How it works
All conversions route through pixels. rem → px multiplies by the root font size; em and % go through the parent font size (% = value/100 × parent); pt → px multiplies by 96/72 (the CSS definition: 1 in = 96 px = 72 pt); vw → px multiplies by viewport width/100. Converting out of px divides by the same factors, so A → B → A returns the original value.
Frequently asked questions
Why does everyone convert px to rem with 16?
Because browsers ship with a 16 px default root font size, so rem = px/16 on an untouched page. If the site sets html { font-size: 62.5% } — a once-popular trick — the root is 10 px and every 16-based conversion is wrong. Set the root field here to whatever your project actually uses.
What is the difference between em and rem?
em is relative to the parent element’s font size, so nested ems compound: 1.2em inside 1.2em is 1.44× the root size. rem is always relative to the root, so it never compounds — which is why design systems prefer rem for spacing and font sizes, and keep em for things that should scale with their component.
Is % here the same as % for widths?
No. This tool’s % is the font-size percentage, relative to the parent font size. A width or margin percentage is relative to the containing block’s width — a different base, and not what is computed here.
How do pt and px relate?
Exactly: 1 pt = 4/3 px (1.333…), because CSS fixes 1 inch at 96 px and print fixes it at 72 pt. 12 pt type is 16 px.
What viewport width should I use for vw?
The width you are designing for — 1440 is a common desktop canvas, 390 a current phone. 1 vw is 1% of whatever you enter.
First time embedding? Read the step-by-step guide →
More free tools
Base64 Encode / Decode
Encode text to Base64 or decode it back.
Color Converter (HEX ↔ RGB)
Convert HEX to RGB and back, with live preview.
Unit Converter
Convert length, weight and temperature instantly.
Currency Converter
Daily ECB reference rates for 26 currencies — updated once per business day.
World Clock & Time Converter
Current time in major cities, plus converter.
Meeting Time Planner
Find overlap hours across time zones.