Streamline your CSS with instant unit conversions.
Scalability. REM units are relative to the root html font-size. This means if a user changes their browser's default font size (for visual impairment), your entire layout scales proportionally.
Pixels are absolute units. They ignore user settings, which is bad for accessibility.
The formula is incredibly simple:
REM = Pixels / Root Font Size
Most browsers have a default root size of 16px. So, 16px = 1rem, 32px = 2rem, etc.
Using relative units like REM and EM ensures that your website respects the user's preferences. It is a core requirement for WCAG (Web Content Accessibility Guidelines) compliance.
Developers often set html { font-size: 62.5%; } in CSS. This sets value to 10px (62.5% of 16px), making math easier (e.g. 1.6rem = 16px).
Yes, modern screens with high pixel density can render sub-pixels.