Toolnido

PX to REM Converter: Pixels, rem and em for Your Base Size

Convert px to rem and em, or rem and em back to px, for the root size you use. Get a table of common sizes you can copy into your CSS. Runs in your browser.

Everything is worked out in this browser. Nothing is uploaded or sent to a server.

Convert a size

Browsers start at 16 px. Use the size set on the html element in your CSS.

Leave blank to use the root size. em is relative to the parent element, rem to the root.

Separate with commas or spaces, for example 15, 22, 30.

When to use this

  • You have a design in pixels and want the rem values for your CSS.
  • Your root font size is not 16 px and you need the whole scale for it.
  • You want to turn rem or em back into pixels to check a size.

How to use

  1. Type the value and choose its unit: px, rem or em.
  2. Set the root font size. It is 16 px unless your CSS changes it.
  3. Add a parent font size only if you want em values for a nested element.
  4. Press Convert. Copy the CSS value or the table.

Examples

Understanding the result

1 rem is the root font size in pixels, so px divided by the root size is rem. 1 em is the font size of the parent element, so px divided by the parent size is em. If you leave the parent blank the tool uses the root size for em, which is only right when the parent has the root size. Values are shown with up to 4 decimals and no trailing zeros.

Limitations

FAQ

How do I convert px to rem?

Divide the pixels by the root font size. At the default 16 px, 24 px is 24 / 16 = 1.5 rem.

What is the difference between rem and em?

rem is relative to the root element's font size, em to the font size of the parent element. em values can compound when elements are nested.

What is the default root font size?

Most browsers use 16 px unless the user or your CSS changes it. Check the font size on your html element.

Why use rem instead of px?

rem sizes follow the font size a person sets in their browser, which can help readers who need larger text. px sizes stay fixed.

Does this tool send my numbers anywhere?

No. The conversion runs in your browser. Nothing you type is sent to a server.

Related tools