PX to REM: Conversion Table, the 62.5% Trick and clamp()
Short answer: a rem is the font size of the root (html) element. Browsers set it to 16px by default, so rem = px ÷ root and px = rem × root. At the default, 24px is 1.5rem. The PX to REM Converter converts one value, a list or a whole block of CSS for any root size, including the 62.5% setup, and builds a fluid clamp() size.
Why use rem
Users can change the default font size in their browser settings. Sizes written in rem follow that choice, while sizes in px do not. That is why many stylesheets use rem for text and spacing. For the accessibility side of text sizes and contrast, see WCAG colour contrast.
Conversion table
Exact results for the two root sizes people use most:
| Pixels | At 16px (default) | At 62.5% (1rem = 10px) |
|---|---|---|
| 10px | 0.625rem | 1rem |
| 12px | 0.75rem | 1.2rem |
| 14px | 0.875rem | 1.4rem |
| 16px | 1rem | 1.6rem |
| 18px | 1.125rem | 1.8rem |
| 20px | 1.25rem | 2rem |
| 24px | 1.5rem | 2.4rem |
| 32px | 2rem | 3.2rem |
| 48px | 3rem | 4.8rem |
| 64px | 4rem | 6.4rem |
The 62.5% setup
Setting html { font-size: 62.5%; } makes 1rem equal 10px, which makes the arithmetic easy. In the tool, choose the percent unit and enter 62.5. Check your own stylesheet: the converter only knows the root size you give it.
Converting a list or a CSS block
- List of values: paste numbers; a bare number counts as px (or rem if you chose rem to px). In Auto mode, values with a unit such as
1.5remare converted the other way. - CSS block: paste CSS and every
pxlength is converted, including insidecalc()and shorthand such asfont: 12px/20px. Check the notes under the output. - Output as: plain values, ready-made declarations (
font-size: 1.5rem;) or custom properties. - Options let you write zero without a unit and keep 1px and smaller as
px, which suits hairline borders.
Fluid sizes with clamp()
The helper builds a clamp() value for text that scales smoothly between two screen widths. Enter a minimum size, a maximum size, and the two screen widths; it uses the root size and decimal places you set and shows a table of sizes at different widths. Copy the value into your CSS.
How to use the PX to REM Converter
- Open the PX to REM Converter.
- Set the root font size. Leave it at 16px unless your stylesheet changes
html. - Type a single value, paste a list, or paste a CSS block.
- Copy the output. For a fluid size, use the
clamp()helper.
After conversion, tidy the stylesheet with the CSS Formatter & Minifier, and check colour pairs with the Contrast Checker.
Limits to know
- It converts lengths. It does not know your design.
- If the root size in your real CSS differs from the one you set, results will be wrong.
- Everything runs in your browser.
Frequently asked questions
How many px is 1rem? 16px by default, unless the root size is changed.
How do I convert 24px to rem? 24 ÷ 16 = 1.5rem.
What is the 62.5% trick? It makes 1rem equal 10px.
Can I convert a whole stylesheet? Yes, paste a CSS block.
Is rem better than px? Rem follows the user's font setting; px does not.