CSS unit converter

Convert between px, rem, em, pt, %, vw, vh, cm, mm and inches with the font size and viewport you choose. At the bottom you can paste a whole stylesheet and turn every px into rem.

Your data stays on your computer. Files are processed in your browser and are never uploaded.

Calculation base

For rem. Usually 16.
For em and %.

Conversion

px (pixels)24
rem1.5
em1.5
pt (points)18
pc (picas)1.5
% (of parent)150
vw1.875
vh3.3333
cm0.635
mm6.35
in (inches)0.25

Quick table px → rem

4px0.25rem
8px0.5rem
10px0.625rem
12px0.75rem
14px0.875rem
16px1rem
18px1.125rem
20px1.25rem
24px1.5rem
28px1.75rem
32px2rem
36px2.25rem
40px2.5rem
48px3rem
56px3.5rem
64px4rem
72px4.5rem
80px5rem
96px6rem
128px8rem

Convert a whole stylesheet

Paste your CSS: every value in the chosen unit is rewritten in the other one. Comments, strings, url() and @media conditions are left alone (unless you ask otherwise).

How it is calculated

A CSS inch is 96 px, a point is 1/72 of an inch. rem uses the root font size, em and % the parent's, vw and vh one percent of the viewport. cm and mm are "CSS" units: on screen they do not always match the real measure.

Why rem

With rem, sizes follow the font size the visitor chose in the browser: text and spacing scale together, which helps accessibility. The 16 px base is only the default.

Where the data goes

The CSS you paste stays on this page: nothing is saved or sent.

Keyboard shortcuts

In this tool

This tool has no keyboard actions.

Everywhere

Open this panel (outside text fields)
?
Closes panels and menus, never clears data
Esc
Search for a tool
/ or CtrlK

Tool chains

Link several tools into a path: after using a tool, “Send to…” offers the next step first. Saved chains keep only a name and the tools, never your data.

Saved chains

No saved chains.

New chain