PX to REM Converter helps you convert fixed pixel values into relative rem units for cleaner, more flexible CSS. This is useful when building responsive layouts, design systems, typography scales, spacing rules, and components that should respect the user's browser font settings.
1. Set the base font size
The default base is 16px, which matches most browsers. If your project changes the root font size on the html element, enter that value first so the conversion matches your CSS.
2. Convert pixels to rem
Type a pixel value in the Pixels field. The tool instantly calculates the rem value using the formula pixels divided by base font size. For example, 24px with a 16px base becomes 1.5rem.
3. Convert rem back to pixels
Click the swap button to change direction. Enter a rem value, and the converter will show the matching pixel value. This is helpful when checking existing CSS or translating a design token.
4. Copy the result
Use the copy button under either field to copy a ready-to-use CSS value, including the unit. You can paste it directly into stylesheets, Tailwind config files, or component code.
When should you use rem?
- Use rem for font sizes, spacing, border radius, and layout values that should scale consistently.
- Use px when you need a fixed one-to-one screen value, such as hairline borders or precise icon sizes.
- Keep one base size across your project unless your design system has a clear reason to change it.
Practical tips
- Start with common values from Quick Reference for faster everyday conversions.
- Use 0.875rem for 14px text and 1.125rem for 18px text when the base is 16px.
- Check your browser zoom and root font-size settings when a design does not look as expected.