Map Extract
Free tool

CSS unit converter

Type a value, choose its unit, and see it in all six common CSS units at once. Set the root font size, the parent font size and the screen width to match your own site.

Runs in your browser. Nothing you enter is uploaded.

Example: matching a design to a site builder

A designer's mock-up for a solicitor's website uses 18 px body text. The theme's custom CSS expects rem, and the site's root font size is the usual 16 px.

Entering 18 px gives 1.125 rem, 1.125 em with a 16 px parent, 13.5 pt, 112.5% and 1.25 vw at a 1440 px wide screen. The designer uses font-size: 1.125rem, which also respects visitors who have set a larger default text size in their browser.

Input
18 px; root 16 px, parent 16 px, viewport 1440 px
Result
1.125rem
1.125em
13.5pt
112.5%
1.25vw

Converting a value

  1. Enter the value and unit

    Type a number and choose px, rem, em, pt, % or vw.

  2. Describe the context

    Three boxes tell the converter about your page: the text size set on the html element (rem follows it), the text size of the surrounding element (em and % follow that) and how wide the screen is (vw follows that).

  3. Read all six units

    The results update as you type, with the most useful conversion highlighted.

  4. Use the table

    A reference table lists common pixel sizes from 8 to 96 in rem at your root size.

The units

px
The everyday screen measure in CSS. It stays put when a visitor enlarges their default text.
rem
Short for root em: a multiple of the html element's text size, which is 16 px unless someone changes it.
em
Relative to the parent element's font size, so it compounds inside nested elements.
pt
Points, a print unit. In CSS, 1 pt is 4/3 px, so 12 pt is 16 px.
%
For font sizes, a percentage of the parent's font size.
vw
One hundredth of the viewport width. 1 vw is 14.4 px on a 1440 px screen and 3.9 px on a 390 px phone.

Questions people ask

How do I convert px to rem?

Divide the pixel value by the root font size. With the usual 16 px root, 24 px is 1.5 rem and 14 px is 0.875 rem. Enter the value here with your site's root size and the rem figure appears with the other units, plus a table of common sizes.

Should I use px or rem for font sizes?

rem is generally preferred for text, because it scales when a visitor increases the default font size in their browser, which helps people with low vision. Pixels are fine for borders and fine details that should not grow with text.

Why does vw give a different pixel size on a phone?

vw is a share of the screen width, so the same value is smaller on a narrow phone than on a wide monitor. Change the viewport width here to see the pixel size on different screens, for example 390 for a typical phone.

Where your data goes

Conversions are calculated in your browser and nothing you enter is sent anywhere.

Checked against the tool on

Top