⇄

Pixels to REM

Convert pixels to rem using the available input and format options.

Choose a file or fill the fields, then click Run tool.

About Pixels to REM

Front-end developers often receive designs in pixels but write CSS in rem units so text scales with user settings. This turns a pixel value from a mockup into the matching rem value for a given root font size. It is also handy when auditing an older stylesheet full of pixel values before switching to scalable units.

How it works

The formula is pixels divided by the root font size, which defaults to 16. The result is shown with four decimals and a rem suffix. If the root size field is empty or not a number, 16 is used. It converts one value at a time and does not process whole stylesheets. It runs in your browser, so you can convert many values in a row by changing the pixel field.

How to use Pixels to REM

  1. Complete the available fields: Pixels, Root font size. Use the field labels and examples shown in the workspace.
  2. Select “Run tool” and check the result before copying or downloading it.

Worked example

Enter 24 pixels with root font size 16. The tool shows 1.5000 rem. With a root of 10, 24 pixels becomes 2.4000 rem. A 14 px caption becomes 0.8750 rem, and a 40 px heading becomes 2.5000 rem at the default root of 16.

Tips for a better result

  • Use the root font size set on your html element. If you changed it, enter that value instead of 16.
  • Trim trailing zeros before pasting, so 1.5000 becomes 1.5, to keep your CSS tidy.
  • Do not use a root of zero. The division would give an infinite result.

Frequently asked questions

Is rem the same as em?

No. Rem is relative to the root element's font size. Em is relative to the parent element. This tool calculates rem only.

Why 16 as the default?

Most browsers use 16 pixels as the default root font size, so the form starts there.

Can I convert rem back to pixels?

Not in this tool. Multiply rem by the root font size yourself.

What to check

Some measures vary by region or date and may not have a universal equivalent.

Read the Privacy Policy for information about local processing, connected services and advertising.