SanWebCorner · CSS Tools
PX to REM & REM to PX Converter
Convert pixels to REM or REM to pixels using an explicit root font size. Enter the root size your stylesheet actually uses, choose a direction, and calculate the result.
How to convert PX and REM
- Select Pixels to REM or REM to pixels.
- Enter the value to convert.
- Enter the root font size in pixels; 16px is the initial example, not a universal guarantee.
- Select Convert value, then copy or download the result.
The conversion formulas
REM = pixels / root font size
Pixels = REM * root font size
24px / 16px = 1.5rem
1.5rem * 20px = 30px
The rem unit is relative to the root element’s font size, unlike em, which depends on the relevant element’s font context. MDN’s CSS length reference describes font-relative units.
Choose the correct root size
Inspect the computed font size of the html element in your target page. Stylesheets, user font preferences and browser settings can affect it. This tool performs arithmetic using your supplied number; it does not inspect or modify another website’s styles.
Using rem can make a design respond to root-size changes, but conversion alone does not make a page accessible. Test text resizing, zoom, wrapping and layout behavior in the real interface.
Limits and precision
The root must be between 0.1 and 256px, and the input must be between −1,000,000 and 1,000,000. Zero, negative or empty root sizes are rejected rather than silently replaced with 16. Results use up to 12 significant digits; recurring fractions are rounded.
Frequently asked questions
Can I convert negative values?
Yes. Negative spacing can be meaningful, but the result may not be valid for a property that rejects negative lengths.
Is 1rem always 16px?
No. It depends on the root element’s computed font size in the target document.
Does changing the conversion direction reuse the last result?
It keeps the entered input value and clears the old output. Enter the desired value for the new direction, then convert again.
Local processing and downloads
The tool component runs locally in your browser without a conversion API or saved input history. Copy exports the current output; Download saves the current result. Normal website advertising and analytics still run on this page.