CSS Unit Converter

Convert CSS sizes, inspect a px-to-rem table or convert a bounded list of values.

On-device No sign-up Free to use

Convert controls

Showing an example. Edit to see your own.

?

A plain number without a unit. The unit comes from the two choices below it.

?

Choose the same unit on both sides to check how a length is written in that unit.

?

The size one rem stands for. Check the html element font size in your page.

?

Use the inherited font size when converting font-size itself, or the element’s computed font size for lengths such as padding. Enter that basis in CSS pixels.

?

The size that one hundred percent stands for, so one percent is this divided by 100. Used only when a percent unit is part of the conversion.

?

The pixel width one hundred vw stands for, so 1vw is this divided by 100. Used only when vw is part of the conversion.

?

The pixel height one hundred vh stands for, so 1vh is this divided by 100. Used only when vh is part of the conversion.

?

Adds 13 rows from 8px to 64px, each written in rem at the root font size you set.

?

One length per line as a number and an optional unit, such as 24px or 1.5. A line without a unit uses the "convert from" choice above. Up to 50 lines; every result uses the "convert to" choice.

Processed in your browser. Your inputs stay on this device.

Result

Showing an example.

Convert 2rem to CSS pixels using an entered root font size of 16px.

2rem converts to 32px. Bases used: 16px root font size.

https://usefreetools.net/css-unit-converter · 20 November 2026

Was this helpful?

How to use CSS Unit Converter

  1. Enter a nonnegative value without a unit, then choose Convert from and Convert to. The same unit on both sides keeps the value in that unit.
  2. Enter the bases needed for the conversion: root font size for rem, the applicable font-size basis for em, reference size for %, or viewport width/height for vw/vh. The page does not read another site.
  3. Optionally add one length per line to Convert a list of lengths. A line such as 24px carries its own source unit; a bare number uses Convert from. All lines use Convert to.
  4. Enable Add a px to rem table if you need common sizes from 8px to 64px at your entered root size. Read the conversion path and bases before copying the result.

Example: CSS Unit Converter

Convert 2rem to CSS pixels using an entered root font size of 16px.

You add
Value: 2; Convert from: rem; Convert to: px; Root font size (px): 16; Font size for em (px): 16; Reference size for % (px): 800; Viewport width for vw (px): 1200; Viewport height for vh (px): 800; Add a px to rem table at the root size above: false
You get
2rem converts to 32px. Bases used: 16px root font size.

Options

Value and units
Value accepts 0 to 100000. Choose px, rem, em, %, vw, vh or pt; enter the number without a unit in the single-value field.
Root and em font sizes
The Root font size field defaults to 16px, but your page or browser preferences can use another size. For em, use the inherited font size when converting font-size itself, and the element’s own computed font size for properties such as padding. Enter that basis in the Font size for em field.
Reference and viewport sizes
One percent is the supplied reference size divided by 100. The correct reference depends on the CSS property. One vw uses viewport width divided by 100, and one vh uses viewport height divided by 100. Enter these dimensions in CSS pixels.
Points
The converter uses 1pt = 4/3 CSS pixels. That relationship does not mean a screen measurement will match a physical ruler.
List and quick table
The list accepts up to 50 nonempty lines, with a number and optional unit on each. The first invalid line stops the run with its line number. The separate quick table shows 13 px-to-rem conversions using the entered root size.

Supported inputs and limits

  • Supports px, rem, em, %, vw, vh and pt.
  • Values accept 0 to 100000; font-size bases accept 1px to 1000px; reference and viewport sizes accept 1px to 100000px.
  • The page uses the sizes you enter and does not infer property context, nested font sizing or mobile browser interface changes.
  • Dynamic/small viewport units and whole stylesheet conversion are unsupported.
  • Fractional results round half up to six decimal places, except that a positive value that would round to zero keeps its digits.
More details

The optional list accepts up to 50 nonempty lines and stops at the first invalid line.

It does not return a partially successful list.

Inputs for unused size references still need to be empty or valid.

Where your input is processed

This tool does not upload your inputs. See the limits for anything saved on your device.

Choose the basis for the property you are measuring

A button can inherit a 16px font and set its own font-size to 1.25em, making that font 20px. Padding of 1em on the button then uses 20px, not the parent’s 16px. Enter 16 as the em basis for the font-size calculation and 20 for the padding calculation. Check computed styles in the browser when the basis is unclear.

Rounding inside a compiled stylesheet

A division such as 20px into rem at a 16px root gives 1.25rem, which finishes exactly. Other pairs do not finish, and the converter rounds the printed answer to six decimal places while the arithmetic keeps more digits. When a design system stores rem values, round the final figure once instead of rounding at every step of a chain.

Questions about CSS Unit Converter

What is the difference between rem and em?

A rem usually uses the root element’s font size. An em uses the element’s computed font size for properties such as padding, but uses its inherited font size when setting font-size itself. Enter the appropriate basis for the property you are converting.

Why does the formula line show a font size?

Relative units need a size to become pixels. The formula names the entered root, em, percentage or viewport basis so you can check the assumption. A pt conversion uses the fixed 4/3 CSS-pixel relationship.

What if my page sets a smaller root font size?

Type that size in Root font size and the rem answers follow it. A root set to 10px, for example, makes 2rem equal 20px on that page.

Does the tool read my stylesheet?

No. It works only with the numbers on the page, inside your browser. None of your site files or settings are uploaded.

What size should I enter for percent or viewport units?

For %, enter the size that the CSS property uses as its reference. For vw and vh, enter the viewport width and height in CSS pixels. These are your inputs; the page does not measure another site or guess the element context.

Page updated · Project managed by Tony Hines · Report a problem with CSS Unit Converter