Skip to content

PX to REM & CSS Unit Converter

PX to REM converter translates CSS lengths using explicit reference sizes. It also supports em, vw, vh and percentages, each with its own context.

Found a problem, or something that could be better? We read every message and we fix things quickly.

PX to REM converter translates CSS lengths using explicit reference sizes. It also supports em, vw, vh and percentages, each with its own context.

Convert one value or paste CSS to transform matching declaration values. Selectors, media-query conditions, strings and URLs stay unchanged; comments and formatting may be removed.

How to use

  1. Enter a value and select its source and target unit.
  2. Set root, element, viewport and percentage reference sizes.
  3. Optionally paste CSS declarations, then generate and copy the result.

Frequently asked questions

Is 1 rem always 16 px?

No. It equals the root element’s font size. Sixteen pixels is a common default, not a fixed conversion rule.

What does the percentage basis mean?

It is the reference size for the property you are converting. CSS percentage bases vary by property; this tool uses the explicit value you supply.

Does CSS mode alter media queries?

No. It walks declaration values, not selectors or media-query conditions.

Does conversion preserve formatting?

No. CSS is parsed and serialized; comments, spacing and original formatting may change. Keep a source copy.

References determine the answer

rem uses root font size, em uses element font size, vw and vh use viewport dimensions, and percent uses the chosen basis.

A context-free conversion can be misleading. For font-size, em and percentages may refer to inherited values; supply the correct context for the specific property.

Converting a stylesheet

Only values matching the selected source unit are changed. String content, URL text and selectors are not searched and replaced.

CSS mode accepts up to 100,000 characters. Review generated code because one global reference cannot represent every nested element or percentage-dependent property.