px to rem converter

Convert px to rem and back with any base font size.

FreeRuns in your browserNo signupUpdated 2026-10-29

rem is relative to the root element, em to the parent, so em compounds when nested.

In rem

1.5rem

24px at a 16px root

Formula

24 ÷ 16

px divided by root size

Converted snippet
font-size: 1.5rem; margin: 1rem 2rem; padding: 0.75rem 1.25rem;

Common sizes

pxremem (same parent)
10px0.625rem0.625em at 16px
12px0.75rem0.75em at 16px
14px0.875rem0.875em at 16px
16px1rem1em at 16px
18px1.125rem1.125em at 16px
20px1.25rem1.25em at 16px
24px1.5rem1.5em at 16px
28px1.75rem1.75em at 16px
32px2rem2em at 16px
36px2.25rem2.25em at 16px
40px2.5rem2.5em at 16px
48px3rem3em at 16px
56px3.5rem3.5em at 16px
64px4rem4em at 16px
72px4.5rem4.5em at 16px
96px6rem6em at 16px

About this tool

How it works and how to read the result.

Need this done for you?

Website design & development

Company websites designed and built to win trust and enquiries.

See the service

What it does

This px to rem converter turns pixel values into rem, and rem back into pixels, using whatever root font size your site sets. Enter one value for a quick answer, or paste a line of CSS and every px value in it is converted at once. A reference table lists the common sizes from 10px to 96px, so you can scan for the one you need without typing anything. All of the arithmetic happens in your browser.

How to use it

  1. Type a value and choose px to rem or rem to px.
  2. Check the root font size. Browsers default to 16px; change it only if your stylesheet sets a different size on html.
  3. Paste a CSS declaration into the snippet box to convert every value in it at once.
  4. Copy the converted snippet, or read the size you need from the table.

How to read the result

The rule is a single division. At the default 16px root, 24px ÷ 16 = 1.5rem. Going the other way, 2.25rem × 16 = 36px.

The snippet font-size: 24px; margin: 16px 32px; padding: 12px 20px; comes back as font-size: 1.5rem; margin: 1rem 2rem; padding: 0.75rem 1.25rem;. Every value is now tied to the root size. If a reader raises their browser's default font size to 20px, the 1.5rem heading grows to 30px and the margins grow with it. Pixel values would have stayed where they were.

Some older sites set html { font-size: 62.5%; } so that 1rem equals 10px and the maths is easier. If yours does, set the root size to 10 here, and 24px becomes 2.4rem. Do not mix the two conventions in one codebase.

The em column in the table only holds when the parent element has the root font size. Em is relative to the parent, so nested ems compound: 1.2em inside 1.2em is 1.44 times the root.

To make sizes scale with the screen as well, use the fluid typography calculator. Our website design and development team builds every site on rem-based tokens.

Questions

Frequently asked.

Should I use rem or px for font sizes?

Rem for font sizes, almost always. Rem respects the reader's browser font setting, so people who need larger text get it. Px is fine for borders, shadows and other details that should not grow with the text. Media queries written in em or rem also behave better when users zoom.

What is the difference between rem and em?

Rem is relative to the root html element, so 1rem is the same everywhere on the page. Em is relative to the font size of the element's parent, so it changes depending on where it is used and compounds when nested. Rem is easier to predict; em suits padding that should scale with a button's own text.

Your next move

Like what you see? Tell us about it.

A process that takes too long, a website that undersells you, or an idea ready to take shape. Tell us where you are and we will suggest a useful next step.

India · Working with clients worldwide

We reply within a working day. No spam, ever.