About this PX to REM
In modern web design, using relative units like REM (Root EM) is essential for accessibility. Unlike fixed Pixels (PX), REM units scale according to the user's browser settings. This calculator helps you translate design mockups (usually in PX) into code-ready REM values.
Who this calculator is for
- Frontend developers converting design specs into accessible CSS sizing tokens.
- Design-system teams standardizing spacing and typography around a shared root font size.
- Anyone migrating a pixel-based stylesheet toward more responsive, user-friendly units.
When to use it
- Convert typography, spacing, or component dimensions from Figma pixels into REM values.
- Check how a non-default root size changes your final CSS output before refactoring a component library.
- Generate a copy-ready `font-size` snippet for documentation or implementation.
How to use this calculator
- Enter the Pixel Value you want to convert.
- Enter the Root Font Size (Standard browser default is 16px).
- Copy the REM Value or the generated CSS snippet.
Key assumptions
- The conversion assumes a single root font size for the page or app section you are styling.
- Results are displayed in REM with rounding that favors readable CSS over excessive decimals.
- The generated snippet focuses on `font-size`, but the same numeric conversion can apply to spacing and layout values.
Accuracy and testing
Review formula sources, default test cases, assumptions, unit handling, rounding rules, and changelog for this calculator.
How this calculator works
Inputs explained
Pixels (px)
The fixed unit value from your design software (Figma, Sketch).
Root Size
The base font-size defined in your CSS `html` selector. Defaults to 16px in almost all browsers.
Understanding your results
Example scenarios
Standard Text
16px / 16 = 1rem.
Heading
32px / 16 = 2rem.
Tailwind Config
14px / 16 = 0.875rem.
Key Features
- Bidirectional calculation
- Custom root size support
- CSS snippet generation
Tips & Best Practices
- Set `html { font-size: 16px; }` explicitly if you want to guarantee 1rem = 16px, though leaving it to the browser default is better for accessibility.
- Avoid the '62.5%' hack (setting root to 10px) if possible, as it can confuse third-party components.
Glossary of Terms
- REM
- Root EM. A unit relative to the font-size of the root element (html).
- EM
- A unit relative to the font-size of the parent element.
- Accessibility (a11y)
- Designing software so it can be used by people with disabilities.