Dev TooloraLocal dev tools

> CSS & Design

CSS Unit Converter

Convert a CSS length between px, rem, em, %, pt, pc, in, cm, mm, Q and viewport units using your own root, parent and viewport sizes.

Runs locallyWorks offline
Auto-run
Back to results
Input

Source data

px
px
px
px
Output

Result

Your result will appear here.

Tool guide

About this tool.

  • Translating a design in px or pt into rem and em.
  • Working out how large a vw value is on a given screen.
  • Converting print units such as mm, cm and Q to screen pixels.
  • Checking what a percentage font size means for a known parent.

Enter a value, pick its unit and set the context: root font size, parent font size and the viewport size.

The output lists the value in every other CSS unit, right-aligned so the numbers are easy to scan.

If you only convert absolute units you can leave the context at its defaults.

Copy the result or download css-units.txt.

  • 24px → 1.5rem, 1.5em, 150%, 18pt, 1.5pc, 0.25in, 0.635cm, 6.35mm, 25.4Q
  • 24px at 1440 x 900 → 1.6667vw, 2.6667vh, 2.6667vmin, 1.6667vmax
  • 1.5rem with root 16 → 24px
  • 2em with a 20px parent → 40px
  • 210mm → about 793.7px
  • 12pt → 16px

  • The value must be between -1,000,000 and 1,000,000, with up to 4 decimals.
  • Root and parent font sizes are 1 to 100 px with up to 2 decimals; viewport width and height are whole numbers from 1 to 10000 px.
  • % means a percentage of the parent font size.
  • Results are rounded to four decimals with trailing zeros removed.
  • Out-of-range or non-numeric values are rejected, never clamped.
  • vmin and vmax use the smaller and larger of width and height.

FAQ

Questions about CSS Unit Converter

What does % mean here?

Percent is converted as a percentage of the parent font size, as it is for font-size. Other properties resolve percentages against different references.

Why do I need to enter a viewport?

Viewport units scale with the window, so the converter needs a width and height. The defaults are 1440 x 900.

Why is 1in always 96px?

The CSS reference pixel is not a device pixel; 1in is defined as 96px regardless of the screen.

Can I convert negative values?

Yes. Negative values convert like positive ones, up to 1,000,000 in either direction.

Continue with

Unit ConverterConvert length, decimal/binary storage and temperature with explicit source and target units.Fluid Type / clamp() GeneratorGenerate a fluid font-size with CSS clamp() between two viewport widths, with a size table and a WCAG zoom warning.