CSS Unit Converter
Convert between CSS units - px, rem, em, pt, vw, vh, and percent - with a configurable root font size.
Enter a value, choose the source and target units, and set your actual root font size - this tool never silently assumes 16px if you've told it otherwise.
For a dedicated, single-purpose px↔rem or px↔em converter, see the PX to REM, REM to PX, and PX to EM tools.
Why Do CSS Units Need Conversion?
rem is relative to the root (html) element's font size, em is relative to its own element's font size, and viewport units (vw/vh) are relative to the browser viewport - none of them convert to pixels with a single universal formula unless you know the relevant base size.
Why Use This Tool?
The common assumption that 1rem = 16px only holds if the root font size is actually 16px - many projects deliberately set a different root size, which changes every rem conversion. This tool always uses the root/parent size you specify.
How to Use It
- Enter your value and its current unit.
- Choose the unit to convert to.
- Set your project's actual root font size (defaults to the standard 16px, but change it if yours differs).
- Read the converted value and the formula used.
Limitations
Viewport unit (vw/vh) conversions to px require a specific viewport size - this tool asks for that explicitly rather than assuming your current screen size, since designs are usually built for a specific target width.