AltUtils

CSS Unit Converter

Convert CSS units between px, rem, em, vw, vh and percentages with a configurable root font size and viewport.

CategoryConverters
Sheet23 / 42
ProcessingIn your browser

html font-size, used by rem

used by em

parent font size or container width

used by vw, vmin, vmax

used by vh, vmin, vmax

Viewport:
Pixelsfrom24px
Root em1.5rem
Em (parent font)1.5em
Percent150%
Viewport width1.6667vw
Viewport height2.6667vh
Viewport min2.6667vmin
Viewport max1.6667vmax
Points (1/72 in)18pt
Picas (12 pt)1.5pc
Inches0.25in
Centimeters0.635cm
Millimeters6.35mm

Absolute units follow the CSS reference: 1in = 96px = 2.54cm, 1pt = 1/72in, 1pc = 12pt. On screens these are not physical inches.

pxrememptCopy
1px0.0625rem0.0625em0.75pt
2px0.125rem0.125em1.5pt
4px0.25rem0.25em3pt
6px0.375rem0.375em4.5pt
8px0.5rem0.5em6pt
10px0.625rem0.625em7.5pt
12px0.75rem0.75em9pt
13px0.8125rem0.8125em9.75pt
14px0.875rem0.875em10.5pt
15px0.9375rem0.9375em11.25pt
16px1rem1em12pt
18px1.125rem1.125em13.5pt
20px1.25rem1.25em15pt
22px1.375rem1.375em16.5pt
24px1.5rem1.5em18pt
28px1.75rem1.75em21pt
32px2rem2em24pt
36px2.25rem2.25em27pt
40px2.5rem2.5em30pt
48px3rem3em36pt
56px3.5rem3.5em42pt
64px4rem4em48pt
72px4.5rem4.5em54pt
80px5rem5em60pt
96px6rem6em72pt
128px8rem8em96pt

What is the CSS Unit Converter?

The CSS Unit Converter turns any length into every CSS unit at once: px, rem, em, %, vw, vh, vmin, vmax, pt, pc, in, cm and mm. Relative units depend on context, so you can set the root font size (for rem), the parent font size (for em), what 100% refers to, and the viewport size (for vw/vh) — with phone, tablet and desktop presets or the size of your current window.

The Convert CSS mode rewrites a whole stylesheet from px to rem (or back) in one pass. It skips comments, strings, url() paths and class names, can keep 1px borders as pixels, and leaves media queries alone unless you ask otherwise. A px-to-rem reference table for the chosen root size is included for quick lookups. Everything is calculated locally in your browser.

Frequently asked questions

How do I convert px to rem?
Divide the pixel value by the root font size. With the browser default of 16px, 24px ÷ 16 = 1.5rem. If your CSS sets html { font-size: 62.5% } the root is 10px, so 24px = 2.4rem — change the root font size field to match.
What is the difference between rem and em?
rem is always relative to the root <html> font size, so it is predictable everywhere. em is relative to the font size of the element's parent (or the element itself for properties other than font-size), so nested em values compound.
Why use rem instead of px?
rem sizes scale with the user's browser font-size setting. Visitors who enlarge their default text size get a proportionally larger layout, which is an accessibility win — fixed px font sizes ignore that preference.
What does % convert to?
A percentage is relative to something different for each property: the parent font size for font-size, the containing block's width for width and padding. Set “100% equals” to that reference value in px to get the right result.
Are cm, mm and in physical sizes?
In CSS they are fixed ratios of the px unit (1in = 96px, 1cm ≈ 37.8px), not true physical lengths on screen. They do match physical size when printing.
Should media queries use rem or px?
rem and em in media queries are always based on the browser's default font size (usually 16px), not on your html font-size. That's why the CSS converter leaves media queries in px unless you enable converting them.
Is my CSS uploaded anywhere?
No. Conversion happens entirely in your browser and nothing you paste leaves your device.