Skip to content
OneTooling

CSS Unit Converter

Convert px to rem, em, pt, vw, vh, and percent with your own root font size, or turn every px in a CSS file into rem. Runs in your browser.

Runs in your browser · nothing uploaded
Mode
Context
px
px
px
px
px
rem
1.5rem
em
1.5em
pt
18pt
vw
1.25vw
vh
2.2222vh
vmin
2.2222vmin
vmax
1.25vmax
%
3%
cm
0.635cm
mm
6.35mm
in
0.25in

Reference table

Based on a root font size of 16px and the element font size above.

Common pixel sizes in rem, em, and points
pxremempt
4px0.25rem0.25em3pt
8px0.5rem0.5em6pt
10px0.625rem0.625em7.5pt
12px0.75rem0.75em9pt
14px0.875rem0.875em10.5pt
16px1rem1em12pt
18px1.125rem1.125em13.5pt
20px1.25rem1.25em15pt
24px1.5rem1.5em18pt
28px1.75rem1.75em21pt
32px2rem2em24pt
36px2.25rem2.25em27pt
40px2.5rem2.5em30pt
48px3rem3em36pt
56px3.5rem3.5em42pt
64px4rem4em48pt
72px4.5rem4.5em54pt
80px5rem5em60pt
96px6rem6em72pt
128px8rem8em96pt

Why is there an ad? This tool is free and runs on your device. One small ad pays for hosting and new tools. No pop-ups, no autoplay, never inside the tool. How we make money

How to convert px to rem and other CSS units

  1. Set your root font size (16px unless your CSS changes it). Add the viewport size if you convert vw or vh.
  2. To convert one value, type it, pick its unit, and copy any result: px to rem, rem to px, px to em, pt, vw, vh, %, vmin, vmax, cm, mm, or inches.
  3. To convert a stylesheet, switch to "Convert a CSS file", paste your CSS, and copy the result with every px value turned into rem or em.

The bulk converter skips comments, strings, and url(...) so file names such as bg-24px.png stay intact. Media queries are left in px by default, because rem-based breakpoints respond to the user's browser font size and not only to the screen.

Questions

Is my CSS uploaded?

No. All conversions are plain arithmetic in your browser. Your CSS never leaves the page.

How many pixels is 1rem?

By default 16px, because browsers set the root font size to 16px. If your site sets html { font-size: 62.5% } then 1rem is 10px. Change the root font size above to match your project.

What is the difference between rem and em?

rem is relative to the root (html) font size, so it is the same everywhere. em is relative to the font size of the element itself, or of its parent for font-size, so nested elements compound. Use rem for predictable spacing and type scales.

Why are 1px borders left alone?

A border of 1px converts to 0.0625rem, which can render blurry or disappear at some zoom levels. The option "Keep 1px borders" leaves values of 1px or less as they are. Turn it off to convert everything.

How are pt, vw, and % calculated?

CSS defines 1pt as 1/72 inch and 1px as 1/96 inch, so 1pt is about 1.333px. vw and vh are 1% of the viewport width and height you enter. A percentage refers to the parent size you enter.

Credits

Built by OneTooling using standard browser features. No third-party code runs on your data.