px and rem converter

Convert CSS lengths using an explicit root font size.

Processed only in this browser
Convert px and rem using an explicit root font size.

Inputs are processed in this browser without sending or saving them to a server, URL or persistent browser storage. Results you copy or save can remain on your device.

How to use this tool

  1. Choose whether the input is px or rem.
  2. Enter the value and the document root font size.
  3. Inspect and copy the result alongside its multiplication or division base.

Example input and result

Input and settings
24px; root 16px
Result
1.5rem

rem uses the root element

rem refers to the document root element’s font size, unlike em which can depend on an ancestor. Enter the actual CSS root value rather than assuming a browser default.

Display rounding and CSS application

Results show up to six decimal places without redundant trailing zeros. Negative inputs can represent uses such as negative margins, but whether a negative length is allowed depends on the CSS property.

Common questions

Does this also convert screen resolution and DPR?

Only the CSS unit base changes. Physical pixels, devicePixelRatio and browser zoom are not calculated, so actual display size can vary.

Standards and references

Read alongside this tool