CSS Unit Converter

Convert between px, rem, em, pt, vh, vw, and %. Click any result to copy it.

Conversion settings

px
px
px
px

Common conversions (base: 16px)

pxremptNotes
10px0.625rem7.5ptsmall labels
12px0.75rem9ptsmall text
14px0.875rem10.5ptbody small
16px1rem12ptdefault body
18px1.125rem13.5ptlarge body
20px1.25rem15pth5
24px1.5rem18pth4
32px2rem24pth3
48px3rem36pth2
64px4rem48pth1

CSS Units: Key Concepts

rem (root em)
Relative to the root element (html) font size. 1rem = 16px by default. Unlike em, rem is not affected by nesting — it always references the root. Preferred for scalable layouts.
em
Relative to the current element's font size (or inherited). In nested elements, em compounds: a child of font-size: 1.5em inside a parent of 1.5em results in 2.25× the root size. Useful for component-scoped scaling.
vw / vh
Viewport width and height units. 1vw = 1% of the viewport width; 1vh = 1% of the viewport height. Dynamic on resize. On mobile, 100vh includes the browser chrome; use dvh (dynamic viewport height) to exclude it.
pt (points)
A physical print unit: 1pt = 1/72 inch. At 96dpi screen resolution, 1pt ≈ 1.333px. Used in print stylesheets and design tools (Figma, Illustrator). Avoid pt for screen CSS — use px, rem, or em instead.

Frequently Asked Questions

When should I use rem instead of px in CSS?

Use rem for font sizes, spacing, and anything that should scale when a user changes their browser's default font size. Browsers default to 16px, so 1rem = 16px — but users on accessibility settings may raise this to 20px, and rem values will scale proportionally. Use px only for things that should stay fixed regardless of user settings, like border widths or icon sizes.

What base font size does rem use by default?

The browser default is 16px, so 1rem = 16px. You can override this with html { font-size: 62.5%; } to make 1rem = 10px, which simplifies mental math (1.4rem = 14px). However, this overrides the user's browser font preference, which hurts accessibility. A better approach is to leave the root font size as the browser default and use rem values as they are.

Why does em compound in nested elements?

em is relative to the element's own font size. If a parent has font-size: 1.5em and a child also has font-size: 1.5em, the child ends up at 1.5 × 1.5 = 2.25em relative to the root — not 1.5em. This compounding behavior makes em tricky in deeply nested components. Use rem when you want consistent sizing that ignores nesting depth.

What is the difference between vw/vh and dvw/dvh?

vw and vh are relative to the initial viewport size — on mobile, this includes the browser's address bar and bottom navigation. When those UI elements hide during scroll, elements sized with vh can overflow. dvw (dynamic viewport width) and dvh (dynamic viewport height) update in real time to always equal the currently visible area. Use dvh for full-screen layouts on mobile to avoid scroll issues.

Should I ever use pt (points) in web CSS?

Generally no. pt is a print unit (1pt = 1/72 inch) and it is only meaningful in print stylesheets (@media print). On screen, pt values are converted based on a fixed 96dpi assumption — 1pt ≈ 1.33px. Design tools like Figma and Illustrator use pt, so this converter helps you translate those values to rem or px for your CSS.