Zero Signup ToolsFree browser tools

Converter Tools

CSS Unit Converter

Convert between every CSS length unit in your browser: px, rem, em, ex, ch, vw, vh, vmin, vmax, pt, pc, in, cm, mm, Q, and percent.

Quick conversions

px

From unit

To unit

Decimal places

Result

16px=1rem

16px / 16 px-per-rem = 1rem

Pixel pivot: 16 px

Ready CSS declaration

font-size: 1rem;

Context

These values define what 1 rem, 1 em, 1 vw, and 1% mean.

The parent element font size in pixels. Set this if you are converting inside a component with a non-default size.

Viewport presets

Percent units resolve against this reference (commonly the parent box width or height for the property being set).

Browsers estimate x-height when the font has no metrics. 0.5 is the spec-defined fallback.

Browsers estimate the 0-glyph advance. 0.5 for proportional, ~0.6 for monospace.

Every unit

The from unit is highlighted in blue. The to unit is outlined in emerald. Every other row is derived from the same pixel pivot.

Absolute units

From

Pixels

16 px

The CSS reference pixel. Every other unit is expressed in pixels for layout math.

Example: 16 px is the default body font size

Converted

Inches

0.1667 in

1 in equals exactly 96 CSS reference pixels. Used for print stylesheets and physical specs.

Example: 0.75 in is a standard letter margin

Converted

Centimeters

0.4233 cm

1 cm equals 96 / 2.54 reference pixels (about 37.795 px). Used for print and physical layouts.

Example: 1 cm is roughly 37.8 px

Converted

Millimeters

4.2333 mm

1 mm equals 96 / 25.4 reference pixels (about 3.78 px). Common in European print specs.

Example: 10 mm = 1 cm = 37.8 px

Converted

Quarter Millimeters

16.9333 Q

1 Q is a quarter millimeter (about 0.945 px). Rarely used outside niche Japanese typography.

Example: 4 Q = 1 mm = 3.78 px

Converted

Points

12 pt

1 pt equals 1/72 inch (about 1.333 px). The classic typographic point used in print and design specs.

Example: 12 pt body text equals 16 px

Converted

Picas

1 pc

1 pc equals 12 pt (exactly 16 px). Old-school typography unit still seen in print measurements.

Example: 1 pc = 12 pt = 16 px

Font-relative units

To

Root em

1 rem

1 rem equals the root element font size (html). Used to respect the user's preferred font scaling.

Example: 1 rem = root font size (default 16 px)

Converted

Em

1 em

1 em equals the parent element font size. Compounds inside nested elements with their own font size.

Example: 1 em = current font size

Converted

x-height

2 ex

1 ex equals the x-height of the current font (the height of a lowercase x). Browsers fall back to ~0.5 em when the font does not expose it.

Example: ~ 0.5 em for most fonts

Converted

Zero advance

2 ch

1 ch equals the advance measure of the 0 (zero) glyph in the current font. About 0.5 em for proportional fonts and 0.6 em for monospace.

Example: Useful for sizing columns by character count

Viewport-relative units

Converted

Viewport width

1.25 vw

1 vw equals 1% of the viewport width. Scales fluidly with the browser window.

Example: 100 vw spans the full viewport width

Converted

Viewport height

2.2222 vh

1 vh equals 1% of the viewport height. Common for hero sections and full-screen layouts.

Example: 100 vh spans the full viewport height

Converted

Viewport min

2.2222 vmin

1 vmin equals 1% of the smaller viewport axis. Useful for square art that must always fit on screen.

Example: On a 1280x720 viewport, 1 vmin = 7.2 px

Converted

Viewport max

1.25 vmax

1 vmax equals 1% of the larger viewport axis. Useful for backgrounds that should always span the longer side.

Example: On a 1280x720 viewport, 1 vmax = 12.8 px

Other relative units

Converted

Percent

1.6 %

Percentages are interpreted against a chosen reference length (usually a parent box width or height).

Example: 50% of a 1000 px reference is 500 px

Conversion factors

  • 1 in = 96 px exactly
  • 1 cm = 96 / 2.54 px ~ 37.7953 px
  • 1 mm = 96 / 25.4 px ~ 3.7795 px
  • 1 Q = 96 / 25.4 / 4 px ~ 0.9449 px
  • 1 pt = 96 / 72 px ~ 1.3333 px
  • 1 pc = 12 pt = 16 px exactly
  • 1 rem = root font size (px)
  • 1 em = parent font size (px)
  • 1 vw = viewport width / 100
  • 1 vh = viewport height / 100
  • 1 vmin = min(vw, vh)
  • 1 vmax = max(vw, vh)

How to use

  1. Type a length value into the value field. Suffixes like px, rem, vw, %, or pt are recognized and offer a one-click swap to set the From unit.
  2. Pick the From unit and the To unit. Use the quick conversion presets at the top to load common cases (16px to rem, 100vw to px, 12pt to px) in one tap.
  3. Open the Context card and set the root font size for rem, the parent font size for em / ex / ch, the viewport width and height for vw / vh / vmin / vmax, and the percent reference length. Viewport presets cover the common breakpoints.
  4. Read the Result card for the headline conversion, the formula, the pixel pivot, and a ready CSS declaration. Use the copy buttons to grab the value or the declaration.
  5. Scroll down to the Every unit grid to see the same input rendered in absolute, font-relative, viewport-relative, and percentage units side by side.
  6. Tap Copy summary to grab a full text block with the input, the pixel pivot, the context settings, and the converted value in every unit.

About this tool

CSS Unit Converter translates any length value between the full set of CSS units a modern browser understands: pixels (px), the font-relative units rem and em, the character-metric units ex and ch, the viewport-relative units vw, vh, vmin, and vmax, the absolute print and physical units pt, pc, in, cm, mm, and Q, and percentage values. Every conversion routes through the CSS reference pixel using the exact ratios published in the CSS Values and Units Level 4 specification: 1 in equals 96 px, 1 pt equals 96/72 px, 1 cm equals 96/2.54 px, 1 mm equals 96/25.4 px, 1 Q equals a quarter of a millimeter, and 1 pc equals 12 pt or exactly 16 px. Font-relative units depend on context that the spec leaves to the document, so the tool exposes each control directly: the root font size for rem, the parent font size for em (and the same value as the basis for ex and ch through a configurable factor that defaults to 0.5 as the spec recommends when the font metrics are unavailable). Viewport units depend on the current viewport, so the viewport width and height are first-class inputs with one-click presets for mobile portrait (375 x 812), tablet portrait (768 x 1024), laptop (1280 x 720), desktop FHD (1920 x 1080), and ultra-wide (2560 x 1080). Percentages resolve against a chosen reference length in pixels, which mirrors how percent units behave in real CSS (a percentage on width resolves against the containing block width, on height against its height, on font-size against the parent font size, and so on). Type a value with or without a unit suffix in the input box (16, 16px, 1.5rem, 100vw, 50% all work), pick the From and To units, and the result appears with the formula, a pixel pivot, a ready-to-paste CSS declaration, and a copy button. Below the headline result, the tool also renders the same value in every other unit grouped by system (absolute, font-relative, viewport-relative, other relative), so you can see at a glance how 24 px reads as 1.5 rem, 18 pt, 0.25 in, 0.635 cm, 1.875 vw at 1280 viewport width, and 1.875% of a 1280 px reference. A copy summary button bundles the input, the pixel pivot, the full unit table, and the context settings into a paste-ready text block. Useful for translating Figma or Sketch specs into CSS, building fluid responsive layouts with viewport units, porting older pixel-based stylesheets to a modern unit system that respects user accessibility settings, mapping print and email specs into screen pixels, generating design system tokens that need to be expressed in multiple units, comparing how a hero size will read across the common viewport breakpoints, and any time you need a precise conversion between two CSS length units. Everything runs locally in your browser; the values you type here never leave your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsConverter Tools