CSS Unit Converter
Converters · Added 18 August 2026
Convert any CSS length into every other one at once. The root and element font sizes are inputs rather than assumptions, so the answer is right for a design system with a 10px root, for a nested component with its own font size, and for a visitor who has enlarged their browser's default text.
Equivalent values
24px in rem
1.5rem
At a 16px root and a 16px element font size
| Unit | Value | Depends on | Copy |
|---|---|---|---|
| Pixels (px) | 24px | Nothing — fixed ratio | |
| Root em (rem) | 1.5rem | Font size | |
| Em (em) | 1.5em | Font size | |
| Points (pt) | 18pt | Nothing — fixed ratio | |
| Percent (%) | 150% | Font size | |
| Inches (in) | 0.25in | Nothing — fixed ratio | |
| Centimetres (cm) | 0.635cm | Nothing — fixed ratio | |
| Millimetres (mm) | 6.35mm | Nothing — fixed ratio | |
| Picas (pc) | 1.5pc | Nothing — fixed ratio | |
| Viewport width (vw) | 1.6667vw | Viewport | |
| Viewport height (vh) | 2.6667vh | Viewport |
px to rem at a 16px root
rem is the accessible default for type and spacing: it scales with the reader's own browser font-size setting, which a pixel value ignores entirely. The one place to keep px is where a value must not scale — a hairline border, or a media query breakpoint, where em and rem both resolve against the browser default rather than your root rule.
How to use the css unit converter
- 1Enter a value and choose the unit you are converting from.
- 2Set the root font size if your stylesheet changes it from the browser default of 16px.
- 3Set the element font size if you are working with em or percentage values inside a component.
- 4Set the viewport dimensions if you need vw or vh.
- 5Copy the converted value straight into your stylesheet from any row.
Examples
The everyday conversion
- Input
- 24px at a 16px root
- Result
- 1.5rem · 1.5em · 18pt · 150%
A 10px root font size
- Input
- 24px at a 10px root
- Result
- 2.4rem — the trick some design systems use to make the arithmetic trivial
Setting html { font-size: 62.5% } makes 1rem = 10px, which is why the same pixel value gives a different rem figure here.
em inside a nested component
- Input
- 24px where the element's own font size is 20px
- Result
- 1.2em — not 1.5em, because em resolves against the element, not the root
About the css unit converter
Why CSS units need a context and metres do not
Every other converter on this site turns one fixed quantity into another: a kilogram is a kilogram wherever you measure it. Most CSS units are not like that. They are defined against something else on the page, and that is precisely why they are useful — a layout built in rem responds to a reader who has set their browser to large text, and a layout built in px does not.
The consequence is that a converter that hardcodes 16px is answering a different question from the one you asked, any time your stylesheet says otherwise. Making the base an input costs one extra field and removes an entire class of wrong answer.
The 62.5% trick, and why it is contentious
Setting html { font-size: 62.5% } makes 1rem equal 10px, which turns every conversion into a decimal shift: 24px is 2.4rem, no arithmetic required. It is popular for exactly that reason.
The objection is that it does not remove the pixel thinking, it just makes it convenient — and that it leaves every element inheriting a 10px font size until something sets it back, which is easy to forget on a component that arrives later. Both positions are defensible. What matters here is that the converter handles either, because the answer genuinely differs.
A rounding note
Values are shown to four decimal places and trailing zeros are dropped, which is more precision than any stylesheet needs. Browsers compute layout in fractions of a pixel and then snap to the device grid when painting, so 1.4375rem and 1.44rem are indistinguishable on screen.
Rounding to two or three decimals in your source is usually the right call for readability. The exception is a value that gets multiplied — a line height, or a modular type scale — where rounding early compounds through the scale and the sizes drift from where the ratio intended them.
Frequently asked questions
What is the difference between rem and em?
Should I use px or rem?
Why does 1pt equal 1.333px exactly?
Are CSS pixels the same as screen pixels?
Why do em and rem behave oddly in media queries?
What about vw and vh?
Related tools
Length Converter
Converters
Convert between millimetres, metres, kilometres, inches, feet, yards and miles.
Number Base Converter
Converters
Convert between binary, octal, decimal, hexadecimal and any base from 2 to 36.
Angle Converter
Converters
Convert degrees, radians, gradians, turns, arcminutes, arcseconds and mils.