px to rem Converter - px, rem and em with a Custom Root Size and a Bulk CSS Mode
Type a size, choose px, rem or em, and see the other two at once. The default root font size is 16px, and you can change it, and the size em refers to, to match your page.
Maintained by Hirantha Sandaruwan Lakshan. Updated 13 October 2026.
About this tool
Or paste a block of CSS and convert every px length to rem in one go, leaving hairline borders and media queries alone if you wish. A table for the sizes people look up most is below.
How it works
A rem is the font size of the root element, the html element. In most browsers that is 16px unless the user changed it, so 1rem is 16px, 1.5rem is 24px and 0.875rem is 14px. The conversion is px divided by the root size: 24px / 16 = 1.5rem. If your stylesheet sets html { font-size: 62.5% }, the root is 10px, so 24px becomes 2.4rem. Type your own root size above and every result follows it.
An em is relative to a font size too, but not the root one. For the font-size property, 1em is the parent element's font size. For every other property, such as padding, margin or width, 1em is the element's own font size. So 24px is 1.5em only when that font size is 16px. Because em values multiply as elements nest, rem is easier to reason about for spacing and type, and em is useful when a component should scale with its own text.
The reason to prefer rem over px is the user's own settings. Browsers let people choose a default font size, and many people raise it to read comfortably. A length in px ignores that choice, while a length in rem is multiplied by it, so a user who sets a 20px default sees 1.5rem as 30px. MDN advises preferring relative lengths for font-size for this reason, and WCAG success criterion 1.4.4 Resize Text expects text to scale to 200 percent without loss. One trap: if your CSS sets html { font-size: 16px }, the root no longer follows the user's setting, and rem stops respecting it. Use a percentage (100% or 62.5%) on the root instead.
The bulk converter reads your CSS with a tokenizer, so it changes only px lengths in real values: never a px inside a string, a url(), a comment or a selector. By default it keeps lengths of 1px or less as px, because a hairline border or outline should stay a thin line whatever the text size, and it leaves the conditions of @media and @container rules alone. Media Queries Level 4 says relative units in a media query are based on the initial value, "defined by the user agent or the user's preferences, not any styling on the page", so 48rem in a media query means 48 times the browser's default size whatever your html rule says. A breakpoint of 768px is 48rem only when the user's default is 16px. If you do switch media conditions on, they are converted at 16px, the browser default, whatever root size you typed, for the same reason. An @property rule is also left alone, because its initial value may not use a relative unit. You can name properties to skip, such as border* or box-shadow.
Worked examples
24px at the default 16px root
24 / 16 = 1.5rem. At a 10px root the same 24px is 2.4rem. If you look at it as em with a 20px parent font size, 24px is 1.2em (24 / 20).
A user who raises the default size to 20px
A heading set to 1.5rem is 24px at the default and 30px when the browser's default is 20px (1.5 x 20). The same heading set to 24px stays 24px. This is the difference rem makes for readers who need larger text.
Converting a card in bulk
Pasting a .card rule with padding: 24px 16px, margin-bottom: 32px, border: 1px solid, border-radius: 8px, font-size: 18px, line-height: 28px and width: calc(100% - 48px) gives padding: 1.5rem 1rem, margin-bottom: 2rem, border: 1px solid (kept), border-radius: 0.5rem, font-size: 1.125rem, line-height: 1.75rem and width: calc(100% - 3rem). The 768px in a @media (min-width: 768px) line is left as px.
px to rem for common sizes at a 16px root and at a 10px root (html { font-size: 62.5% })
| px | rem (16px root) | rem (10px root) |
|---|---|---|
| 8px | 0.5rem | 0.8rem |
| 9px | 0.5625rem | 0.9rem |
| 10px | 0.625rem | 1rem |
| 11px | 0.6875rem | 1.1rem |
| 12px | 0.75rem | 1.2rem |
| 13px | 0.8125rem | 1.3rem |
| 14px | 0.875rem | 1.4rem |
| 15px | 0.9375rem | 1.5rem |
| 16px | 1rem | 1.6rem |
| 18px | 1.125rem | 1.8rem |
| 20px | 1.25rem | 2rem |
| 22px | 1.375rem | 2.2rem |
| 24px | 1.5rem | 2.4rem |
| 28px | 1.75rem | 2.8rem |
| 32px | 2rem | 3.2rem |
| 36px | 2.25rem | 3.6rem |
| 40px | 2.5rem | 4rem |
| 44px | 2.75rem | 4.4rem |
| 48px | 3rem | 4.8rem |
| 56px | 3.5rem | 5.6rem |
| 64px | 4rem | 6.4rem |
| 72px | 4.5rem | 7.2rem |
| 80px | 5rem | 8rem |
| 96px | 6rem | 9.6rem |
Frequently asked questions
What is 16px in rem?
1rem, when the root font size is the common default of 16px. In general rem = px divided by the root font size, so 16px is 1.6rem if your root is 10px, and 0.8rem if it is 20px.
Why use rem instead of px?
Because rem follows the font size the reader chose in their browser, and px does not. People who need larger text often raise that default, and a layout in rem grows with it. It also helps WCAG success criterion 1.4.4, which asks that text can be resized to 200 percent without loss of content or function.
What is the difference between rem and em?
rem is always relative to the root element's font size. em is relative to the font size of the element it is used on, or of its parent when it is used in the font-size property. Nested em values multiply (1.2em inside 1.2em is 1.44 times the base), which is why rem is the easier unit for global sizing.
Should media query breakpoints be in rem or em?
If you use relative units in a media query, remember that they are based on the initial value (the browser's default font size), not on your html font-size rule. A min-width of 48rem or 48em then means 48 times the user's default size, so the layout changes sooner for a reader who enlarged the default. That is often the point, and it is why this tool leaves media queries in px unless you ask it to convert them. When you do, it converts them at 16px, the browser default, not at your root size.
Does html { font-size: 62.5% } break accessibility?
Not by itself. A percentage on the root is a percentage of the browser default, so it still scales when the user changes that default; 62.5% of 16px is 10px, which makes the arithmetic easy. What breaks the user's setting is a fixed size such as html { font-size: 10px }. The catch with 62.5% is that body text must then be set back to something like 1.6rem.
Should a 1px border become rem?
Usually not. A border is a thin line, not a piece of text, so it has no need to grow with the reader's font size, and 1px as 0.0625rem is an awkward fraction. That is why the bulk converter keeps lengths of 1px and smaller as px by default. You can turn that off if you do want them converted.
How do I convert rem to px?
Multiply by the root font size. At a 16px root, 1.25rem is 1.25 x 16 = 20px. Choose rem in the From box above and the px result is shown with the working.
Sources & references
Updated Oct 13, 2026