DailyDeskTools home

PX to REM Converter

Convert px to rem and back, with a conversion table and whole-stylesheet conversion.

  • Free forever
  • No signup
  • Runs on your device
PX to REM ConverterRuns locally · nothing uploaded
Loading tool…

How to use the PX to REM Converter

  1. 1Set the root font size. Leave it at 16 unless your site changes it.
  2. 2Type a pixel value to see it in rem, or a rem value to see it in pixels.
  3. 3Open the conversion table for common sizes.
  4. 4Paste CSS into the stylesheet converter to change every px value to rem at once.

What rem means

A rem is relative to the root font size, set on the html element. Browsers default to 16px, so 1rem = 16px, 1.5rem = 24px and 0.75rem = 12px.

rem = pixels ÷ root font size

Why use rem instead of px

When someone increases the default font size in their browser settings for easier reading, sizes in rem grow with it, while sizes in px stay fixed. Using rem for font sizes, spacing and layout widths makes a site respect those preferences, which is an accessibility best practice.

rem versus em

An em is relative to the font size of the element itself (or its parent), so ems compound when nested. A rem always refers to the root, which makes it easier to predict. This converter calculates rem; for em, set the root size to the parent element's font size.

Converting a stylesheet

The bulk converter finds every px value in your CSS and rewrites it in rem. Hairline 1px borders usually look best kept in px, so they are left alone unless you untick the option.

Pixel to rem table (16 px root)

Pixels rem
12 px 0.75 rem
14 px 0.875 rem
16 px 1 rem
18 px 1.125 rem
20 px 1.25 rem
24 px 1.5 rem
32 px 2 rem
40 px 2.5 rem
48 px 3 rem

Worked example

A design file gives a heading at 36 px and 24 px of space under it. With a 16 px root, 36 ÷ 16 = 2.25 rem and 24 ÷ 16 = 1.5 rem. If the root were 10 px, the same values would be 3.6 rem and 2.4 rem, which is why the root field matters.

The 62.5% trick and its catch

Some stylesheets set the root to 62.5% so 1rem equals 10 px at the default setting. That keeps the user's font-size preference, because the percentage scales from it. Setting font-size: 10px on the root does not, and it overrides what people chose in their browser. Avoid that.

Where rem helps

Use rem for type and spacing that should grow with the reader's settings. Keep hairline borders and shadows in px. To check how your layout behaves on real screens, see the device screen sizes list. Gradients and tooltips take px values directly, so the CSS gradient generator and tooltip generator fit alongside this converter, and you can preview styles in the HTML viewer.

Frequently asked questions

How many pixels is 1rem?

16px with the browser default root font size. If your site sets html { font-size: 62.5% }, 1rem is 10px.

Should I use rem for everything?

Rem works well for font sizes, spacing and widths. Borders, shadows and other tiny details are often better left in px.

What root font size should I use?

Use 16 unless your CSS changes the font size of the html element. Check your stylesheet for html { font-size: … }.

What is the difference between rem and em?

rem is relative to the root element's font size, so it is the same everywhere on the page. em is relative to the current element's font size, so nested elements can compound.

How do I convert rem back to pixels?

Multiply by the root font size. At 16 px, 1.5 rem is 1.5 × 16 = 24 px.

Last updated · By the DailyDeskTools team

Built and written with AI assistance, then tested by hand by our team. How we make our tools