PX to REM Converter
Convert pixels to rem and em in real time, with your own base font size. Use the quick reference table, or paste a block of CSS and convert every px value at once.
Quick reference
| px | rem | em |
|---|
Convert a block of CSS
How to use PX to REM Converter on KickSolve
Three quick steps, no account needed.
Why choose KickSolve
Built for speed, privacy and clean results.
What you can do with PX to REM Converter
Everything this tool offers.
About PX to REM Converter on KickSolve
What it does and how to get the best results.
How the px to rem converter works
Rem stands for root em, a unit relative to the font size of the html element. The converter divides the pixel value by your base font size to get rem, and multiplies the rem value by the base to get pixels. Em values use the parent font size you set. Everything runs in your browser.
The px to rem formula
- rem = px / base font size
- px = rem x base font size
- em = px / parent font size
Why use rem units
Rem units respect the font size a user chooses in their browser, so layouts that use rem scale for people who need larger text. They also make it easy to scale a whole design by changing one value on the html element.
Rem vs em vs px
Pixels are fixed and ignore user preferences. Rem is relative to the root, so it is consistent across the page. Em is relative to the parent, which is useful for components that should scale with their own text size but can compound in nested elements.
The 62.5% trick and other bases
Some teams set the html font size to 62.5%, which makes 1rem equal 10px and simplifies the math. It works, but it requires resetting the body font size back to 1.6rem. If you use a custom base, enter it in the settings so every conversion matches your project.
Good to know
- Media queries often work better in em or rem so they respond to the user's font size, but they are not always safe to convert in bulk.
- Unitless line-height is usually better than a converted value.
- Check the converted CSS before shipping it.
Common px to rem values
At the default 16px base font size.
| Pixels | REM | EM |
|---|---|---|
| 8px | 0.5rem | 0.5em |
| 12px | 0.75rem | 0.75em |
| 14px | 0.875rem | 0.875em |
| 16px | 1rem | 1em |
| 18px | 1.125rem | 1.125em |
| 20px | 1.25rem | 1.25em |
| 24px | 1.5rem | 1.5em |
| 32px | 2rem | 2em |
| 40px | 2.5rem | 2.5em |
| 48px | 3rem | 3em |
| 64px | 4rem | 4em |
Frequently asked questions
Quick answers.
How do I convert px to rem?
Divide the pixel value by the root font size. With the default 16px base, 24px divided by 16 equals 1.5rem. This converter does it instantly in both directions.
What is the formula for rem to px?
Multiply the rem value by the root font size. At a 16px base, 1.5rem times 16 equals 24px.
What is the default base font size?
Browsers use 16px as the default root font size. If your site sets a different font size on the html element, enter that value as the base font size in the settings.
Why use rem instead of px?
Rem units scale with the user's browser font size setting, so text and spacing grow for people who increase their default size. Pixels stay fixed, which can hurt accessibility.
What is the difference between rem and em?
Rem is relative to the root element's font size, so it is predictable everywhere. Em is relative to the font size of the parent element, so nested elements can compound.
What is the 62.5% trick?
Setting html font-size to 62.5% makes 1rem equal 10px, which makes mental math easier. Change the base font size here to 10 if you use it.
Should I convert 1px borders to rem?
Usually not. A 1px border is meant to be a hairline, and 0.0625rem can render inconsistently. The CSS converter keeps 1px values unchanged by default.
Can I convert a whole stylesheet?
Yes. Paste CSS into the converter box and every px value is converted to rem, or switch the direction to convert rem back to px. Review the result before using it, because media queries and some properties may be better left in px.
How many decimals does the converter use?
Up to four by default, with trailing zeros removed. You can choose 2 to 5 decimal places in the settings.
Is anything uploaded or stored?
No. The conversion runs in your browser and nothing is sent to a server.
More free tools from KickSolve
Related everyday tools.