1001Ferramentas
📏 Converters

CSS px ↔ rem Converter

Convert between px and rem in CSS with a configurable root font base (default 16px). Essential for responsive, accessible layouts with scalable typography.

The rem math without a mental calculator

The mockup comes in px, the project uses rem, and you catch yourself dividing 24 by 16 in your head for the tenth time today, or worse, botching 13 divided by 16 and guessing 0.8. This page does the math both ways: type a px value and the rem appears; type rem and the px updates. The :root base is configurable, with the browser default of 16px already filled in.

Rem is relative to the root element's font-size, and that is exactly why it matters: the default is 16px, but users can raise it in their browser settings, and everything set in rem scales along while anything in px stays frozen. There is also the old trick of setting the html font-size to 62.5%, which makes 1rem equal 10px for easier math; if your project uses that convention, switch the base to 10 here and the numbers come out right.

Use rem for font sizes, spacing and widths that should follow the user's font preference; px still makes sense for 1px borders and details that should not scale. Be careful not to confuse it with em, which is relative to the element and compounds through inheritance, while rem always points at the root. The result comes out unrounded (13px at base 16 gives 0.8125rem) and can be copied as is: browsers accept as many decimal places as you give them. Everything runs locally.

Frequently asked questions

How many rem is 24px?
At the default 16px base, 24px equals 1.5rem. If your project uses the 62.5% trick, where 1rem equals 10px, the same 24px becomes 2.4rem; change the base field and the tool redoes the math.
Should I convert everything to rem?
No need. Typography, spacing and reading widths gain accessibility from rem; thin borders, shadows and 1-2px details usually work better fixed in px.
What is the difference between rem and em?
Em is relative to the element's own or its parent's font-size, so values compound through inheritance and get hard to predict. Rem always points at the :root: 1.5rem is worth the same anywhere on the page.

Related Tools