CSS Unit Converter
ConvertEverything runs locally in your browser — nothing is uploaded
Enter one value and see it in every unit at once. What `rem` is relative to, what `em` is relative to and which viewport `vw` uses are all adjustable — because these units are relative by design, relative to a runtime environment rather than a constant: `rem` follows the root font size (which the user can change in their browser; 16px by default), `em` follows the current element’s font size, and `vw` / `vh` follow the viewport. So each figure carries a line saying what it assumed, instead of handing you a number that looks just as certain as the next one. If the input carries a unit (`24px`) that unit is used; otherwise the one chosen in the dropdown is. The absolute units are here too: `1in = 96px` is defined by CSS and has nothing to do with the screen’s real pixel density.
Features
- Eleven units at once: px, rem, em, vw, vh, vmin, vmax, pt, in, cm, mm
- Adjust what the relative units are relative to: root font size, current font size, viewport width and height
- Every relative row states its assumption inline, so the assumption is never mistaken for a fact
- The input may carry a unit (24px, 1.5rem) or not; without one the dropdown decides
- Full-width digits, full-width punctuation and pasted quotes are all understood — those come from the input method, not from you
- Results are grouped (relative units, absolute units) and each row copies on its own
- Computed live, with no Run button; an empty input falls back to a 24px sample so the page is never blank
How to use
- Enter a value in the input, for example 24px
- If you entered only a number, choose its unit in the dropdown
- Adjust the root font size, current font size and viewport as needed
- Read the results and copy any single row
FAQ
- Why is there no percentage row?
- Because a percentage has no single meaning in CSS: `100%` in a font size means the inherited size, while a percentage in width, height, `padding` or `translate` each resolves against something different (the containing block, the element’s own size, the viewport…). The tool cannot know which property this value will end up in, so any number it printed would be invented. For font sizes the `em` row is exactly equivalent (`1em === 100%`), so everyday conversions are unaffected.
- Why no ch, ex, lh or cqw?
- Because their conversion depends on things this tool cannot see. `ch` is the width of the 0 glyph and `ex` the height of a lowercase x — both depend on the font metrics in use; `lh` is the current line height; `cqw` is relative to the nearest container query container. None of those are known until the element actually renders, so any offline conversion would produce a plausible wrong answer. Entering one of these units gets an explanation rather than a silent fallback to px.
- How many pixels are in an inch?
- 96, fixed by the CSS specification and unrelated to the screen’s physical pixel density — which is why this tool needs no “screen resolution” input. Only print work (real physical dimensions) needs the other conversion, and that is what a PPI calculator is for. `pt` follows from it: 72 points to the inch, so `1pt = 96 ÷ 72 ≈ 1.333px`, and `12pt` is exactly `16px`.
- What is the actual difference between rem and em?
- `rem` is always relative to the root element (`<html>`), so changing it once changes everything; `em` is relative to the current element’s font size, which is usually inherited from its parent, so the same CSS nested one level deeper gives a different result — which is both its purpose (scale with context) and where it surprises people. Keeping them as two separate adjustable parameters is meant to make that difference visible.
Related tools
Unit Converter
ConvertConvert between 26 categories of units — length, weight, temperature, energy, pressure, flow, force, density and more. All in your browser.
PPI Calculator
ConvertEnter a resolution and screen size to get pixel density in PPI, dot pitch in millimetres and the aspect ratio, plus a plain-language verdict.
CSS Formatter
FormatFormat CSS online: one declaration per line, selectors split at commas. Minify only strips structural whitespace, keeping meaningful spaces in values.
Timestamp Converter
ConvertConvert Unix timestamps into dates and back, telling seconds, milliseconds, microseconds and nanoseconds apart, with Windows FILETIME and decimals.
Date Calculator
ConvertCount the days, weeks or months between two dates, or shift a date by any of those. Dates can be picked from a calendar or pasted in — nothing is uploaded.
Number Base Converter
ConvertConvert numbers between binary, octal, decimal, hex, base 36 and base 64, with long IDs converted digit for digit. Runs in your browser.