HelperCrate

CSS Unit Converter

Convert px, rem, em and vw using your own root font size and viewport width.

Your files never leave your device. Everything runs in your browser.

What CSS Unit Converter does

CSS lengths are relative more often than not, which is why a value copied from a design file rarely survives the trip to a stylesheet unchanged. CSS Unit Converter translates a value between pixels, root-relative rem, em and viewport-relative vw, using base sizes that you supply.

The tool needs those base sizes because a browser computes them at render time and a calculator cannot see the page. Enter the root font size and the viewport width you are designing against, and the four result rows show the equivalent value in every unit.

One limitation is worth stating plainly. In real CSS, em is relative to the parent element's font size, while rem is relative to the root. This tool has no parent font-size input, so it calculates em against the root font size and its em result only matches a browser when the parent size happens to equal the root size. Use rem for predictable sizing, or evaluate em with the real parent size in mind.

How to use CSS Unit Converter

  1. Enter the value you want to convert.
  2. Choose its current unit from the dropdown: px, rem, em or vw.
  3. Set the root font size in pixels; the default is 16, the usual browser default.
  4. Set the viewport width in pixels; the default is 1440.
  5. Read the px, rem, em and vw rows, then copy the one you need.

Features

Tips and common mistakes

Frequently asked questions

What is the difference between rem and em?

rem is always relative to the root element's font size, so it stays predictable everywhere. em is relative to the font size of the element's parent, so it compounds with nesting. This tool treats em as if the parent matched the root, which is the one behaviour to watch.

Why do I have to enter the root font size and viewport width?

A calculator cannot know your page's computed styles or the device viewport. Supplying both makes the maths explicit and reproducible instead of guessing at common defaults.

Is the root font size always 16px?

Sixteen pixels is the usual browser default, but users can change the default font size and designers often set a different html font size. The tool cannot detect it, so enter the root size your page actually uses.

How precise are the results?

Each result is rounded to four decimal places. That is enough for typical pixel work; if you need more precision for a design token pipeline, calculate with the formulas directly.

Does vw include the scrollbar?

The unit converter just applies the percentage you give it. In a browser, 1vw is one percent of the viewport width including the space reserved for a classic scrollbar, so use the real resolved width when exactness matters.

Is anything uploaded?

No. The conversion runs entirely in your browser.

CSS conversions are calculated in your browser — no values are uploaded.