PX to REM Converter
Convert pixels (px) to rem and rem to pixels side by side. Change the root font size, convert multiple pixel values, and copy results for your CSS stylesheet.
Convert multiple px values to rem
Enter pixel values separated by commas, spaces, or new lines. Results use the root font size above.
| Pixels | REM |
|---|---|
| Converting sample values… | |
How to convert px to rem and rem to px
With a root font size of 16px, divide a pixel value by 16 to get rem. For example, 8px ÷ 16 = 0.5rem. To convert in the other direction, multiply the rem value by the root font size: 1rem × 16 = 16px. If your project uses a different root font size, change the setting in the converter and the results will update.
px = rem × root font size
PX to REM conversion examples (16px root)
These common conversions use a root font size of 16px. Values are rounded only when necessary.
| Pixels | Equivalent rem | Example use |
|---|---|---|
| 4px | 0.25rem | Tiny gaps or details |
| 6px | 0.375rem | Compact spacing |
| 8px | 0.5rem | Small padding |
| 10px | 0.625rem | Small text or gaps |
| 12px | 0.75rem | Small text or padding |
| 14px | 0.875rem | Compact body text |
| 16px | 1rem | Default text size |
| 18px | 1.125rem | Larger body text |
| 20px | 1.25rem | Subheadings |
| 24px | 1.5rem | Heading or gap |
| 28px | 1.75rem | Medium heading |
| 32px | 2rem | Section spacing |
| 40px | 2.5rem | Large gap |
| 48px | 3rem | Large heading or spacing |
| 64px | 4rem | Wide spacing |
REM to PX examples (16px root)
| REM | Equivalent pixels |
|---|---|
| 0.25rem | 4px |
| 0.5rem | 8px |
| 0.75rem | 12px |
| 1rem | 16px |
| 1.125rem | 18px |
| 1.25rem | 20px |
| 1.5rem | 24px |
| 2rem | 32px |
| 2.5rem | 40px |
| 3rem | 48px |
| 4rem | 64px |
Why use rem units in CSS?
Rem units are relative to the root element's font size, which can make typography and spacing scale consistently when that base size changes. Pixel units can still be useful for fixed details such as thin borders. Check the root font size used by your project before relying on a conversion table, because a custom root size changes every px-to-rem and rem-to-px result.