Converters ● Local processing

PX to REM Converter

Convert a CSS pixel value to rem using the root font size you choose.

Preparing tool…
Try a worked example

Try a worked example

Convert a CSS pixel value to rem using the root font size you choose.

Check the units and options, then use the tool’s calculation button. The example is fictitious; replace its values for your own calculation.

Example input

CSS pixel value
24
Root font size (px)
16

Expected output

24px ÷ 16px = 1.5rem

Convert a CSS pixel length to rem by dividing by the root element’s font size. With a 16px root size, 24px is 1.5rem. The initial 16px value is only a convenient starting point; use the value set by your project.

Waiting for the tool. The explanation remains available without JavaScript.

Method and limits

Enter the CSS value in pixels and the font size of your document’s root element. The root-size field starts at 16px; change it to match your stylesheet if needed. The tool divides pixels by the root size to return rem.

Enter a non-negative CSS pixel value and a positive root font size. The result is rounded to at most six decimal places, so very small values can display as 0rem. The calculator does not read the root size from your stylesheet.

✓ Local processing✓ No account✓ Inputs processed here✓ Free

Quick answer

Convert a CSS pixel length to rem by dividing by the root element’s font size. With a 16px root size, 24px is 1.5rem. The initial 16px value is only a convenient starting point; use the value set by your project.

The page and its assets load from the site; this operation uses your entered values only in this browser and does not send them to a calculation endpoint.

How to use it

Enter the CSS value in pixels and the font size of your document’s root element. The root-size field starts at 16px; change it to match your stylesheet if needed. The tool divides pixels by the root size to return rem.

Limits

Enter a non-negative CSS pixel value and a positive root font size. The result is rounded to at most six decimal places, so very small values can display as 0rem. The calculator does not read the root size from your stylesheet.

Frequently asked questions

What does 1rem mean?

It is based on the font size of the root element, usually <html>. A common browser default is 16px, but user preferences or stylesheet rules can change it.

Does this tool read my stylesheet?

No. It uses the root size you enter. Keep the default 16px only if that matches your page; otherwise enter your project’s root font size.

How is the conversion calculated?

Divide the pixel value by the root font size. For example, 24px ÷ 16px = 1.5rem.

Further guidance

Choose the right root font size for px-to-rem conversion

Sources and references

These references document the cited standard or browser API; they do not validate the tool’s output.