Web & Developer

PX to REM Converter

Converts pixel values to CSS rem units instantly — enter a px value and get the rem equivalent for any root font size.

px
px
REM Value
Awaiting input
Percentage
Browser scale
EM Equivalent
Relative to parent

Instantly convert standard pixel (px) values into scalable root em (rem) units to build accessible and fully responsive web layouts.

CalcuSense
Reviewed by CalcuSense

This team builds, tests, and maintains free online calculators designed to make everyday calculations faster, simpler, and reliable for users around the world.

Pixel values work fine until someone bumps their browser font size up to 20px — at which point every hard-coded measurement on the page stays frozen while the rest of the interface scales. That’s the practical reason developers move sizing to relative units. The px to rem converter above handles the arithmetic instantly: enter a pixel value, confirm your root font size, and get the rem equivalent ready to paste into your stylesheet.

The Formula: One Division, Every Time

REM (root em) is always relative to the font size declared on the html element. The conversion is: rem = px ÷ root font size. At the browser default of 16px: 24px ÷ 16 = 1.5rem. Going back: 1.5 × 16 = 24px. That’s the entire calculation. The only variable is your root font size — if your project sets html { font-size: 18px; }, then 1rem equals 18px everywhere in that document, and the math shifts accordingly.

Common PX to REM Values at 16px Base

The 16px base is the browser default and the starting point for most projects. This table covers the values that come up most in typography, spacing, and layout work.

PX Value REM (16px base) Typical Use
4px 0.25rem Tight spacing, fine borders
8px 0.5rem Small gaps, compact padding
12px 0.75rem Caption text, labels
14px 0.875rem Small body text, secondary UI
16px 1rem Base body text
18px 1.125rem Comfortable reading size
20px 1.25rem Lead text, large body
24px 1.5rem H3 / subheading
32px 2rem H2 heading
48px 3rem H1 / hero heading
64px 4rem Display type, large hero

REM vs EM vs PX: Which Unit Goes Where

The three units solve different problems. Using them interchangeably creates inconsistency; using each in its right place keeps the stylesheet predictable.

Unit Relative To Predictability Best For
px Nothing — fixed Always exact Borders, shadows, 1px hairlines, icon sizes that must never scale
rem Root html font size Consistent everywhere Typography, spacing, layout — anything that should scale with user settings
em Parent element’s font size Changes per context Component-level scaling: padding/margin relative to the component’s own text size

The compound inheritance problem with em is the main reason most teams standardize on rem for global sizing. If a parent is set to 1.25em and a child inside it is also 1.25em, the child renders at 1.25 × 1.25 = 1.5625× the root size — not 1.25×. With rem, both the parent and child always refer back to the html element regardless of nesting depth, so the value is always what you typed.

The 10px Root Trick — and Why to Think Twice Before Using It

A widely used technique sets the root font size to 62.5% (html { font-size: 62.5%; }), which makes 1rem equal to 10px in most browsers. The appeal is obvious: 24px becomes 2.4rem, 16px becomes 1.6rem — the mental math is trivial. The problem is that it overrides the user’s browser font size preference. If someone has set their browser default to 20px for readability, your 62.5% declaration drops that to 12.5px — smaller than what the user explicitly chose. The purpose of using rem in the first place is to respect user font preferences; this technique defeats it.

The more accessible approach is to leave the root at the browser default (or at a percentage of it, not an absolute), and use the converter to handle the px-to-rem math during development.

When to Use PX Anyway

REM isn’t always the right choice. Certain properties should stay in pixels:

  • Borders and outlines — a 1px border should stay 1px. A 1rem border at a large root size becomes a thick visual element that breaks the design.
  • Box shadows — shadow blur and spread values are visual effects, not layout elements. Scaling them with font size creates unintended visual shifts.
  • Media query breakpoints — technically these should use em (not rem and not px) since they respond to the browser’s default font size, not the root declaration. But px breakpoints are simpler and work in most practical cases.
  • SVG dimensions with fixed aspect ratios — when an icon or illustration needs to hold exact pixel dimensions, px provides that guarantee.
  • 16px in every major browser — Chrome, Firefox, Safari, and Edge all use 16px as the default html font size. This is why the 16px base is the standard starting point for px-to-rem conversions.

  • Yes. Users who increase their browser's default font size for readability see rem-based layouts scale correctly with that preference. Pixel-based layouts stay fixed. WCAG 2.1 Success Criterion 1.4.4 (Resize Text) is easier to satisfy with relative units.

  • Multiply the rem value by your root font size. At 16px base: 1.5rem × 16 = 24px. The converter handles both directions.

  • Only rem and em. Pixel values, viewport units, and percentages are all independent of the root font size declaration.

What were you looking for?