PX to REM Converter: CSS Unit Calculator

Use this px to rem converter to switch CSS sizes between pixels and rem units. Set your root font size, often 16 px, type a value, and get the answer both ways. A table of common sizes makes it easy to build responsive, accessible layouts.

PX to REM Converter

px ⇄ rem for CSS.

-
-
Everything runs in your browser. Nothing you enter or upload is sent to a server.

How to use the PX to REM Converter

  1. Set the root font size (16px is the browser default).
  2. Type a pixel value to get rem.
  3. Or type rem to get pixels.
  4. Use the table for common sizes.

How it works

rem means "root em": a multiple of the html element’s font size. rem = px ÷ root size and px = rem × root size. Using rem lets text scale when users change their browser font size, which helps accessibility.

Example

With a 16px root, 24px = 1.5rem and 0.875rem = 14px.

Frequently asked questions

Why use rem instead of px?

rem respects the user’s font size setting and scales the whole layout.

What is the difference between rem and em?

rem is relative to the root element; em is relative to the parent element.

What if I set html { font-size: 62.5% }?

Then the root is 10px, so 1rem = 10px.

See also: CSS Minifier and Beautifier, Unit Converter.

Convert px to rem

How to use it

  1. Set the root font size.
  2. Enter a pixel value.
  3. Read the rem value.
  4. Or enter rem to get pixels.

More questions

Why use rem?

Rem sizes scale when users change their browser font size.

What is the default root size?

Most browsers use a default root font size of 16 px.

What is 24px in rem?

24px is 1.5rem when the root font size is 16 px.

Related tools: CSS Box Shadow Generator, CSS Gradient Generator, CSS Minifier and Beautifier.

Common type sizes at a 16px base

Set the root font size (16px by default), then enter pixels to get rem or enter rem to get pixels. A table of common sizes sits below the result. To check text contrast for accessible type, use the Color Contrast Checker.

Worked example: at a 16px base, 18px is 1.125rem (18 ÷ 16) and 2.5rem is 40px (2.5 × 16). A 14px caption is 0.875rem.

More answers

How many rem is 18px?

At the default 16px root size, 18px is 18 ÷ 16 = 1.125rem.

How do I convert 2.5rem back to pixels?

Multiply by the root size: 2.5 × 16 = 40px. The tool shows the same value when you enter 2.5 in the rem box.