01 / px to rem
px divided by root
At a root size of 16px, 24px is 24 divided by 16, which is 1.5rem.
Free tool
Type pixels and get rem, or type rem and get pixels, against the root font size you set. Em, percent of the root and points show beside it, with the CSS line ready to copy. Below are tables of common sizes, and a batch box: paste a block of CSS and every px value is converted in one go, leaving 1px borders, media query widths and url() alone.
Convert a whole CSS snippet
px to rem and em
| px | rem | em |
|---|
rem to px
| rem | px |
|---|
Click a row to copy its value.
Root font size
Batch options
Browsers start with 1 rem equal to 16px, and a visitor can change that in their settings. Set your own root size if your CSS changes it. Settings are remembered in this browser.
Converted in your browser. Your CSS is not uploaded.
The maths
01 / px to rem
At a root size of 16px, 24px is 24 divided by 16, which is 1.5rem.
02 / rem to px
1.5rem at the same root is 1.5 times 16, which is 24px.
03 / em
em uses the parent element's font size instead of the root, so set the parent size to match.
Guide
A px to rem converter turns a pixel size into rem by dividing it by the root font size, and turns rem back into pixels by multiplying. A rem is a length in CSS that equals the font size of the root element, which is the html tag. This page does the sum for you, both ways, with a root size you can change, and also gives em, percent and points. It can convert a whole stylesheet snippet at once.
font-size: 1.5rem;.rem = px divided by the root size. With the usual 16px root: 12px is 0.75rem, 14px is 0.875rem, 18px is 1.125rem, 24px is 1.5rem and 32px is 2rem. Going back, 0.875rem times 16 is 14px.
The same size in a different root gives a different rem. At a root of 10px, 24px is 2.4rem. This is the idea behind setting the html font size to 62.5%: the browser default of 16px becomes 10px, so 1.6rem is 16px and the sums are easier to do in your head. It also works only while the visitor keeps the default.
Browsers start at a root size of 16px, and visitors can change it in their settings. A size written in rem follows that choice, and a size written in px does not. MDN's note on font-size says that to maximise accessibility, it is generally best to use values that are relative to the user's default font size. That is the reason many style guides put text, spacing and breakpoints in rem. Borders and thin lines are often left in px, because a 1px line should stay 1px.
The rem unit looks at the root element, so 1.5rem is the same size everywhere on the page. The em unit looks at the element's own font size (or the parent's, when used in font-size), so it can compound when elements nest. If a parent is 20px and a child asks for 1.5em, the child is 30px, and a grandchild asking for 1.5em is 45px. This converter's em result divides by the parent size you give it.
Paste your CSS into the batch box. Every px value becomes rem, rounded to the decimals you set with trailing zeros removed, and 0px becomes plain 0. Three things are left alone by default: values inside url(), CSS comments, and the widths in @media, @container and @supports conditions. A value of exactly 1px (and -1px) is also kept, and you can untick that. With the example CSS, 24px 16px becomes 1.5rem 1rem, 18px becomes 1.125rem, margin-top of -8px becomes -0.5rem, and the 1px border is kept.
You can also go the other way: choose rem to px or em to px under Convert, and the box multiplies instead.
The CSS Values specification defines 1in as 96px and 1pt as 1/72 of an inch. So one point is 96 divided by 72, or 1.3333px, and 12pt is 16px. The points card on this page is the pixel value times 0.75. The pixel here is a CSS pixel, not one dot on your screen.
Sources, checked 18 Oct 2026: MDN on CSS lengths for rem, em and the 16px default, MDN on font-size for the accessibility advice, CSS Values and Units for the inch, point and pixel, and Media Queries Level 4 for units inside queries.
To work with colours next, try the lighten and darken colour tool, or turn a hex code into RGB with the hex to RGB converter.
Questions
Divide the pixels by the root font size. At 16px, 24px is 24 / 16 = 1.5rem.
16px in browsers by default, but it follows the root font size. MDN says a common browser default is 16px and that user settings may change it.
Multiply the rem by the root size. 1.25rem at 16px is 20px.
It makes 1rem equal 10px at the default size, since 62.5% of 16 is 10. Then 1.6rem is 16px.
Use rem for text and spacing that should grow with the visitor's font setting. Use px for thin borders and things that must not scale.
rem is relative to the root element. em is relative to the current or parent element, so it can add up when elements nest.
Not by default. Untick Leave media query widths alone to convert them too.
No. It is converted in your browser.