Paritian

Developers

PX to REM Converter (CSS Units)

Convert a CSS pixel size to rem, em, points, percent and viewport units, for any root font size.

Results

Size in rem (and em at root size) 1.5000 rem
Size in points 18.00 pt
As a percentage of the root size 150.00 %
In viewport width units (vw) 1.6667 vw

What this tool does

Sizes in rem follow the font size the reader has chosen in the browser, so text and spacing set in rem scale for people who need bigger letters, while pixel sizes ignore that setting. Browsers start from 16 px, which is why 1 rem is usually 16 px; change the root size if your stylesheet sets another one on the html element. One CSS point is 1/72 of an inch and one CSS pixel 1/96, so a pixel is always 0.75 pt. To go the other way, multiply the rem value by the root size.

Formula

rem = px ÷ root size · pt = px × 0.75 · vw = px ÷ viewport width × 100

Variables

SymbolMeaningUnit
pxSize in pixelspx
bfRoot font sizepx
vwViewport widthpx
REMSize in rem (and em at root size)rem
PTSize in pointspt
PCAs a percentage of the root size%
VWIn viewport width units (vw)vw

Worked example

  • Size in pixels24 px
  • Root font size16 px
  • Viewport width1440 px
  • Size in rem (and em at root size)1.5000 rem
  • Size in points18.00 pt
  • As a percentage of the root size150.00 %
  • In viewport width units (vw)1.6667 vw

Limitations

  • The calculation runs entirely in your browser. The values you type are never sent to a server.
  • The calculation runs at full precision and only the display is rounded. If you copy an intermediate value and retype it, small differences can appear.