About PX to REM Converter
Converting pixels to rem is one of the most common CSS tasks. The formula is simple: divide the pixel value by the root font size. With the default size of 16px, 24px is 1.5rem and 8px is 0.5rem.
Type the pixel value and click Run Tool. The result shows px converted to rem and rem converted back to px at the chosen base size. Use rem for typography and spacing so your layout respects the user's font size setting.
How to use PX to REM Converter
- Type the pixel value, for example 24.
- Change the base font size if your project uses something other than 16px.
- Click Run Tool and copy the rem value into your CSS.
Example
Input
18
Output
18px = 1.125rem 18rem = 288px
Common uses
- Converting a design from Figma or Photoshop, where sizes are in pixels, into rem.
- Updating an older px-based stylesheet to scalable units.
- Checking spacing scales such as 4px, 8px, 16px and 24px in rem.
Privacy and safety
This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.
Frequently asked questions
What is 16px in rem?
With the default 16px root size, 16px is 1rem, 12px is 0.75rem and 32px is 2rem.
Why is the result a long decimal?
Some pixel values do not divide evenly. For example 10px is 0.625rem. You can round to three decimals in your CSS.
Does media query width use rem?
It can. Many teams use em or rem in media queries so breakpoints also respond to the user's font size.