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
font-size: 1.5rem; margin: 1rem 2rem; padding: 0.75rem 1.25rem;
Common sizes
| px | rem | em (same parent) |
|---|---|---|
| 10px | 0.625rem | 0.625em at 16px |
| 12px | 0.75rem | 0.75em at 16px |
| 14px | 0.875rem | 0.875em at 16px |
| 16px | 1rem | 1em at 16px |
| 18px | 1.125rem | 1.125em at 16px |
| 20px | 1.25rem | 1.25em at 16px |
| 24px | 1.5rem | 1.5em at 16px |
| 28px | 1.75rem | 1.75em at 16px |
| 32px | 2rem | 2em at 16px |
| 36px | 2.25rem | 2.25em at 16px |
| 40px | 2.5rem | 2.5em at 16px |
| 48px | 3rem | 3em at 16px |
| 56px | 3.5rem | 3.5em at 16px |
| 64px | 4rem | 4em at 16px |
| 72px | 4.5rem | 4.5em at 16px |
| 96px | 6rem | 6em 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 serviceWhat 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
- Type a value and choose px to rem or rem to px.
- Check the root font size. Browsers default to 16px; change it only if your stylesheet sets a different size on
html. - Paste a CSS declaration into the snippet box to convert every value in it at once.
- 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