How-To5 min read

How to Convert CSS Units Online for Free

CSS has over a dozen unit types and choosing the right one — or converting a design spec from pixels into responsive rem values — takes mental arithmetic that slows you down. This guide explains the key units and shows you how to convert between them instantly using a free browser-based tool.

CSS Units Quick Reference

UnitTypeRelative to
pxAbsoluteDevice pixel (1/96 of an inch on screen)
remRelativeRoot element font size (usually 16px)
emRelativeCurrent element's font size
vwViewport1% of viewport width
vhViewport1% of viewport height
ptPrint1/72 of an inch
cm / mm / inPrintPhysical dimensions

Step-by-Step Instructions

1

Open the CSS Unit Converter

Navigate to the free CSS Unit Converter. It runs entirely in your browser — no account, no server, no tracking.

2

Enter the source value

Type a number into any unit field (e.g. 24 in the px field). All other fields update immediately.

3

Set the root font size (if needed)

The default base font size is 16px, matching most browser defaults. If your project uses html { font-size: 62.5% } (which gives 10px), set the base to 10. This affects rem and em results.

4

Set the viewport dimensions (if needed)

vw and vh conversions require knowing the viewport size. The defaults (1440×900) cover most desktop screens. Update them for your target device.

5

Copy the value you need

Click any output field to select it, then press Ctrl+C (Cmd+C on Mac) to copy. Paste directly into your stylesheet.

When to Use Each Unit

  • rem — preferred for font sizes, spacing, and layout that should scale with the user's browser font-size setting
  • px — borders, box shadows, and precise dimensions that should not scale
  • em — spacing relative to the component's own font size (e.g. line-height: 1.5em)
  • vw / vh — full-screen sections, fluid typography with clamp(), hero heights
  • pt / cm — print stylesheets only

Convert CSS units now

px → rem, em, vw, vh, pt, cm and more — 100% browser-based, no uploads, no account.

Open CSS Unit Converter

Related Tools