PX to REM Converter
Convert between px, rem, em, pt and percent at any root font size, or turn every px value in a stylesheet into rem.
Runs in your browser. Nothing is uploaded.
How to use the PX to REM Converter
- Set the root font size, usually 16 px, and the parent font size if you need em or percent values.
- Type a value and choose its unit to see it in px, rem, em, pt and %.
- Use the table of common sizes as a quick reference at your root size.
- To convert a whole stylesheet, paste CSS into CSS with px; every px value becomes rem.
- Choose which small values to keep in px (such as 1 px borders) and whether to convert media queries.
CSS units without mental arithmetic
Designs are usually measured in pixels, but good CSS often uses relative units. rem follows the
root font size and respects users who enlarge text in their browser. em follows the font size of the
element itself, which is handy for padding that scales with a button’s text. pt appears in print and
some design tools, and percent in font sizes is relative to the parent. Converting between them means
dividing by 16 in your head, or by whatever base size the project uses. This converter does it for you.
Convert a single value
Enter a number, choose its unit, and see the equivalent in all five units. Set the root font size for rem and the parent font size for em and percent. Most browsers use 16 px as the default root size; some projects set 10 px or 62.5% to make the maths easier, and the converter handles any base.
Convert a whole stylesheet
Paste CSS into the bulk converter and every px value is rewritten as rem at your root size:
24px becomes 1.5rem, and 0px becomes 0. Comments, quoted strings and url() values are left
untouched, so file names like icon-24px.svg stay correct. Options let you:
- Keep small values in px, such as 1 px hairline borders that should never scale.
- Convert media queries too, so breakpoints follow the user’s font size.
Quick reference table
The table lists common pixel sizes, from 1 to 128, with their rem and pt values at your root size, useful when matching a design spec or a typography scale.
All conversions happen in your browser. For layouts that use these units, try the CSS Grid Generator and Flexbox Playground.
Frequently asked questions
What is the difference between rem and em?
rem is relative to the root font size, the html element, so 1.5rem is the same everywhere on the page. em is relative to the current element’s font size, so it compounds when elements are nested.
Why use rem instead of px?
When people increase the default font size in their browser settings, sizes in rem grow with it, while px sizes stay fixed. Using rem for text and spacing respects that choice and helps accessibility.
Why keep 1 px borders in px?
Hairline borders are meant to stay thin. Converting 1px to 0.0625rem can round to zero or blur on some screens, so values up to 1 px are kept by default.
Should media queries use rem?
Using em or rem in media queries makes breakpoints follow the user’s font size, which many accessibility guides recommend. It also changes when layouts switch, so it is an option rather than the default.
Is my CSS uploaded?
No. Everything is converted in your browser.
Tutorials
How to convert a stylesheet from px to rem
Rewrite every px value in your CSS as rem in one step, keep hairline borders in px, and decide whether media queries should change too.