Designs are usually measured in pixels, but CSS written in rem scales with the visitor's font size settings, which makes a site easier to read for people who need larger text. This converter moves between the two using your root font size.
Figures checked by Muhammad Ahmad against W3C: Understanding WCAG 1.4.4 Resize Text. Prices and rules change, so confirm with the official source before relying on them. How we check the math
How it works
One rem equals the font size of the root html element. Browsers set that to 16px by default, so 1rem is 16px unless your CSS changes it.
To convert pixels to rem, divide by the root font size. To convert rem to pixels, multiply by it.
Points are a print unit. In CSS, 1px is defined as 0.75pt, so the calculator multiplies pixels by 0.75.
A worked example
With the default 16px root size, 24px is 1.5rem (24 ÷ 16), and 18pt in print terms. Going the other way, 0.875rem is 14px.
More examples
14px is 0.875rem at a 16px base, and 2.5rem is 40px.
Common mistakes
- Using px for font sizes, which ignores the user's text-size setting.
- Assuming media queries in rem use your root font size; they use the browser default.
- Nesting em values, which compound.
- Converting borders and hairlines to rem.
Questions people ask
Should borders and shadows be in rem?
Usually not. A 1px border or hairline shadow should stay 1px at any text size, so pixels are fine for fine details. Use rem for text, spacing and layout sizes.
What is the difference between rem and em?
Rem is always relative to the root font size, so it means the same thing everywhere on the page. Em is relative to the font size of the element's parent, so it compounds when elements are nested.
Should I set the root font size to 62.5%?
Some sites set html { font-size: 62.5% } so that 1rem equals 10px and the math is easier. It works, but you then need to set a readable size on the body again. Keeping the default 16px and using a converter avoids that extra step.
Why use rem at all if I design in pixels?
If a visitor increases their browser's default font size, text sized in rem grows with it and text sized in px does not. Using rem for font sizes, and often for spacing, respects that setting.
How do I convert px to rem?
Divide the pixel value by the root font size, which is 16px by default in browsers. 24px ÷ 16 = 1.5rem.
How many pixels is 1rem?
16px by default, because browsers set the root font size to 16px. If a user raises their browser's default font size, 1rem grows with it, which is the main reason to use rem.
Guides
- PX vs REM in CSS: When to Use Each and How to ConvertRem sizes follow the reader's font settings; pixel sizes do not. Here is how the conversion works and where each unit makes sense.
- Aspect Ratios Explained: 16:9, 4:5, 9:16 and How to ResizeAn aspect ratio is width to height reduced to its simplest form. Here is how to find it, and how to calculate a new size that keeps it.