Start a project

Tool 67 of 244 · CSS

CSS Units Converter

Convert any CSS length between px, rem, em, viewport units and points, with your own root size and screen, or convert a whole stylesheet to rem at once.

CSS Units Converter at a glanceIllustration: 1, A value in any unit; 2, processed in your browser; 3, px, rem, em, vw….CSS Units Converter16px = 1rem1A value in any unit</>3px, rem, em, vw…2In yourbrowser
1 A value in any unit 2 processed on your device 3 px, rem, em, vw…

CSS Units Converter

Convert a value

Context

1rem; browsers default to 16
For em and %

Equivalents

UnitValueCopy
All values

Convert a whole stylesheet from px to rem

Keeps 1px borders crisp
Converted CSS

01

What it does

Converts between px, rem, em, %, vw, vh, vmin, vmax and pt, and turns a whole stylesheet from px into rem.

  • Nine units, converted both ways
  • Your own root, parent and viewport sizes
  • One-click copy for each value
  • Whole-stylesheet px to rem conversion

02

Private by design

Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

03

What you get

Values and converted CSS, with a Copy and a Download button on every result.

  • rem
  • px
  • Viewport units
  • CSS

Why it matters

Sizes in rem follow the reader's chosen browser text size; sizes in px don't. Someone who sets larger text because of low vision gets bigger rem-based type and spacing, while a px-based layout ignores them. That's why most accessibility guidance recommends rem for font sizes.

Designs usually arrive in pixels, though, so converting is a constant chore. This tool does single values with your real context, and can convert an entire stylesheet in one go while leaving 1px borders alone.

How it works

  1. InputA value and its unit
  2. In your browserConverted using root size, parent size and viewport
  3. OutputThe same length in every CSS unit

Where it fits in a designer's workflow

  1. Plan
  2. Design
  3. Build
  4. Test
  5. Launch
Turning a design file's pixels into accessible rem values.

By the numbers

How many CSS pixels each absolute unit is1in: 96px; 1cm: 37.8px; 1pc: 16px; 1rem (16px root): 16px; 1pt: 1.33px; 1mm: 3.78px; 1Q: 0.94px1in96px1cm37.8px1pc16px1rem (16px root)16px1pt1.33px1mm3.78px1Q0.94px
Fixed by the CSS spec: 1in = 96px, 1pt = 1/72in, 1pc = 12pt. rem follows the root font size, which is 16px in every major browser unless the user changes it, so set type in rem to respect their choice. Source: CSS Values and Units Level 4: absolute lengths.
Show the numbers as a table
UnitCSS pixels
1in96
1cm37.8
1pc16
1rem (16px root)16
1pt1.33
1mm3.78
1Q0.94

How to use it

  1. Enter a value and choose its unit.
  2. Set the root font size (usually 16px), the parent size for em and %, and the viewport.
  3. Copy any equivalent from the table.
  4. To convert a stylesheet, paste it below and copy the result.

FAQ

Why is 16px equal to 1rem?

Browsers use 16px as the default root font size, so 1rem is 16px unless the site or reader changes it.

What's the difference between rem and em?

rem is relative to the root (html) font size, so it's the same everywhere. em is relative to the current element's font size, so it compounds inside nested elements.

Should media queries use rem?

em is the safest choice for media queries because it follows the reader's text size consistently across browsers. The converter can leave media queries alone if you prefer to keep px there.

How many pixels is 1pt?

1pt is 1/72 of an inch and 1px is 1/96 of an inch in CSS, so 1pt = 1.333px and 12pt = 16px.

Work with me

Want a site that gets these right?

I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

All developer tools · Back to leej.uk