CSS Unit Converter (px, rem, em)

Convert between px, rem, em, %, pt, vw, vh and print units, using your own base font size.

FreeNo sign-upPrivate — runs in your browser
Settings: root 16px, parent 16px, viewport 1440 × 900

px to rem table (16px root)

How to use the CSS Unit Converter

  1. Enter a valueType a number and choose its unit, for example 24 px.
  2. Check the settingsThe default root font size is 16px. Change it, the parent font size or the viewport if your design uses different values.
  3. Copy a resultEvery unit is shown at once. Click any result to copy it.

Example

24px = 1.5rem = 18pt = 1.6667vw on a 1440px-wide screen, with the default 16px root.

With a 10px root font size (html { font-size: 62.5% }), 24px becomes 2.4rem.

Frequently asked questions

How do I convert px to rem?

Divide the pixel value by the root font size. With the default 16px, 24px ÷ 16 = 1.5rem. The table under the converter lists common sizes.

What is the difference between rem and em?

rem is relative to the root (html) font size, so 1rem is the same everywhere on the page. em is relative to the font size of the parent element, so it can change as elements are nested.

Why use rem instead of px?

rem sizes grow when a visitor increases the default font size in their browser, which makes your site more accessible. Many designers use px in mockups and rem in code.

How are pt, cm and inches converted?

CSS fixes 1 inch at 96px, so 1pt = 1/72 inch = 1.333px, 1cm = 37.8px and 1mm = 3.78px. These are mainly useful for print style sheets.

Popular posts from this blog

Character Counter

Speech to Text Online

Keyboard Tester