PX to REM Converter
About this tool
About PX to REM Converter
Rem units make a site respect the reader's font-size setting, but designs usually arrive in pixels. This converter handles both directions. Type into either the pixel or the rem box and the other updates instantly, using the base font size you set (16px unless your project changes the root size). A reference table lists common sizes from 1px to 128px at your base, ready to download as CSV. For bigger jobs, paste a stylesheet and every px value is rewritten to rem in one go, with the count of values changed. Comments, strings and url() paths are left alone, 1px hairline borders can be kept as pixels, and media query conditions can be left in px, which is what most teams want. Choose 2 to 5 decimal places, switch the direction to turn rem back into px, or switch to em when you're working with sizes relative to a parent element. Copy or download the converted CSS. All of it runs locally.
Built and maintained by Abhi JainUpdated
How to Convert PX to REM
- 1
Set the base font size
Enter the base font size. Browsers default to 16px for the root element.
- 2
Convert a value
Type a number into Pixels or rem; the other box updates. Copy the result.
- 3
Convert a stylesheet
Paste CSS under Convert a stylesheet, choose the direction and options, then copy or download the converted CSS.
PX to REM Converter: questions and answers
How do I convert px to rem?
Divide the pixel value by the root font size: rem = px ÷ base. With the default 16px base, 24px ÷ 16 = 1.5rem and 14px ÷ 16 = 0.875rem.
How many pixels is 1rem?
1rem equals the font size of the root html element, which is 16px in every major browser unless the user or your CSS changes it.
What is the difference between rem and em?
Rem is relative to the root font size, so it's the same everywhere on the page. Em is relative to the current element's font size, so it compounds when elements are nested. Use the PX to EM Converter for em values.
Should I set html { font-size: 62.5% }?
That trick makes 1rem equal 10px for easier maths, but it means every component must set its own font size. With a converter, it's simpler to keep the default 16px and convert.
Should media queries use rem or px?
Media queries in em or rem respond to zoom more consistently in some browsers, but px works fine in modern ones. This tool leaves media query conditions alone by default so breakpoints don't change unexpectedly.
Ready-made PX to REM Converter presets
Related Tools
- Type Scale GeneratorModular type scale with ratio presets, a live specimen and CSS or Tailwind output.
- Viewport Unit CalculatorConvert px to vw, vh, vmin and vmax for any screen size, and back.
- CSS Clamp GeneratorFluid clamp() values between two viewports for type and spacing.
- Spacing Scale GeneratorSpacing tokens on a 4 or 8-pt grid, t-shirt sizes or a ratio, as CSS variables or Tailwind.