Pixel to REM Converter
Convert pixels to REM units and back. Set your base font size, see a reference table of common values, and copy CSS with one click.
Usually set to the root font-size (default 16px in browsers)
Pixels
16.00px
REM
1.000rem
CSS Output
Common Values Reference
| Pixels | REM | Usage |
|---|---|---|
| 12px | 0.750rem | Small text |
| 14px | 0.875rem | Body text |
| 16px | 1.000rem | Body text |
| 18px | 1.125rem | Subheading |
| 20px | 1.250rem | Subheading |
| 24px | 1.500rem | Heading |
| 32px | 2.000rem | Heading |
| 48px | 3.000rem | Large heading |
| 64px | 4.000rem | Large heading |
Text Preview
Small (12px / 0.750rem)
Base (16px / 1.000rem)
Large (24px / 1.500rem)
XL (32px / 2.000rem)
Why REM Beats Pixels for Font Sizes
Browsers default the root font size to 16px. One rem equals the root font size, so 1rem = 16px out of the box, and 24px = 1.5rem, 12px = 0.75rem. The tool defaults to a 16px base; type a pixel value and see the rem instantly, or flip to rem-to-pixel mode if you're reading a stylesheet that uses rem. The conversion happens on every keystroke with no Calculate button.
REM matters because users can change their browser default from 16px to anything they like, usually for accessibility. If your CSS uses px everywhere, the user's setting is ignored and your text stays the size you hard-coded. If your CSS uses rem, every text size, padding, and spacing value scales with the user's preference. WCAG accessibility guidelines effectively require this; users with low vision who set their browser default to 24px depend on REM-based sites to render readably.
EM vs REM and the 62.5% Reset Trick
REM is always relative to the root html element. EM is relative to the parent element's font size, which means EM compounds: a 1.5em inside a 1.5em is 2.25 times the root. EM is useful for component-internal spacing where you want a button's padding to scale with its own font size. REM is what you want for global typography and layout because the maths is predictable: 1rem = root size, no matter how deeply nested.
The classic 'set html font-size to 62.5%' trick (which makes 1rem = 10px) lets you write 1.6rem instead of mentally converting 16px to 1rem. It works but it has a quiet cost: if a user has set their browser default above 16px for accessibility, your 62.5% multiplier propagates that change but at a smaller starting point. Modern guidance is to leave html font-size alone, write 1rem for body text, and use the Tailwind-style scale (0.875rem, 1rem, 1.125rem, 1.25rem, 1.5rem, 1.875rem, 2.25rem) for headings.
Common Pixel Values in REM (16px Base)
| Pixels | REM | Tailwind Equivalent |
|---|---|---|
| 12px | 0.75rem | text-xs |
| 14px | 0.875rem | text-sm |
| 16px | 1rem | text-base |
| 18px | 1.125rem | text-lg |
| 20px | 1.25rem | text-xl |
| 24px | 1.5rem | text-2xl |
| 32px | 2rem | text-4xl |
| 48px | 3rem | text-5xl |
Frequently Asked Questions
Should I use REM, EM, or PX?
Use REM for typography, layout spacing, and anything that should scale with the user's browser preferences. Use EM for component-internal spacing that should scale with that component's font size (e.g. a button's padding). Use PX for borders, hairlines, and anything that genuinely should not scale (e.g. a 1px divider should stay 1px regardless of zoom).
Does REM work in older browsers?
REM has been supported in every browser shipped since 2012 (IE9+). It's safe to use unconditionally. The only place you'd reach for px today is for one-pixel borders and decorative graphics where you specifically don't want scaling, plus media queries (some teams still prefer px-based breakpoints for predictability).
What about media queries?
Media queries can use rem and the value is calculated against the user-agent default font size, not your html element's font size. So `@media (min-width: 48rem)` resolves to 768px on a default browser, and 1152px if the user has set their default to 24px. This is intentional: it means your breakpoints scale with user accessibility settings, often a feature, sometimes a surprise. Pick a side and stay consistent.
Why does my rem value have lots of decimals?
Pixel-to-rem conversion at non-multiples of 16 produces irrational fractions. 13px = 0.8125rem exactly, 15px = 0.9375rem. Most stylesheets round to three decimal places (0.813rem, 0.938rem). The visual difference between 0.8125rem and 0.813rem is sub-pixel and invisible. The tool shows three decimals, which is enough precision for any production use.
Related Tools
CSS Box Shadow Generator
Build CSS box shadows visually with live preview. Adjust offset, blur, spread, colour, and opacity. Stack multiple layers and copy the CSS.
CSS Gradient Generator
Create beautiful CSS gradients with a visual builder. Choose colours, positions, angles, and gradient type. Copy the CSS with vendor prefixes.
Colour Contrast Checker
Check if your text and background colours meet WCAG accessibility standards (AA & AAA). Auto-fix suggestions included