CalcEngine

PX to REM Converter

Convert Pixels (PX) to REM instantly and vice versa.

PX to REM Converter
Convert pixels to rem instantly using the standard CSS conversion formula.
px
rem
px
16px=1rem

PX to REM Formula

REM = PX ÷ Root Font Size

Example: 32 ÷ 16 = 2rem

REM to PX Formula

PX = REM × Root Font Size

Example: 2 × 16 = 32px

PX ↔ REM Conversion Tables

Pixels to REM

PixelsREM
1px0.0625rem
2px0.125rem
3px0.1875rem
4px0.25rem
5px0.3125rem
6px0.375rem
8px0.5rem
10px0.625rem
12px0.75rem
14px0.875rem
15px0.9375rem
16px1rem
18px1.125rem
20px1.25rem
24px1.5rem
25px1.5625rem
28px1.75rem
32px2rem
36px2.25rem
40px2.5rem
44px2.75rem
48px3rem
50px3.125rem
56px3.5rem
64px4rem
72px4.5rem
75px4.6875rem
80px5rem
90px5.625rem
100px6.25rem

REM to Pixels

REMPixels
0.01rem0.16px
0.03rem0.48px
0.05rem0.8px
0.08rem1.28px
0.1rem1.6px
0.15rem2.4px
0.2rem3.2px
0.5rem8px
1rem16px
2rem32px
3rem48px
4rem64px
5rem80px
6rem96px
8rem128px
10rem160px
15rem240px
20rem320px
30rem480px
40rem640px
50rem800px
60rem960px
80rem1280px
100rem1600px

PX vs REM

FeaturePXREM
ScalableNoYes
ResponsiveLimitedExcellent
AccessibleNoYes
Browser Zoom SupportYesYes
User Font Preference SupportNoYes
MaintainabilityLowHigh
Modern UsageLegacy / fixed sizesRecommended default

What Is REM?

REM stands for root em. It is a relative CSS length unit measured against the font size of the root element — the <html> tag. In every major browser the default root font size is 16px, which means 1rem = 16px out of the box. The power of rem lies in its relativity: when the root font size changes, every length defined in rem scales proportionally with it.

Because rem references a single, predictable origin, it gives developers the consistency of pixels with the scalability of percentages. Spacing, typography, border-radius, breakpoints and even media queries can all be expressed in rem and adjusted globally by changing one number.

What Is PX?

PX (pixel) is an absolute CSS length unit. On modern displays it represents a CSS reference pixel, which the browser maps to physical screen pixels using the device pixel ratio. Pixels are precise and predictable but they do not respond to a user's preferred font size, which is the single biggest reason designers and accessibility experts recommend moving away from px for typography and spacing.

How PX To REM Conversion Works

Converting pixels to rem requires only one input besides the value itself: the root font size. The formula is straightforward:

rem = px ÷ root font size

With the default 16px root, 24px becomes 24 ÷ 16 = 1.5rem, 32px becomes 2rem and 48px becomes 3rem. The math is simple enough to do by hand, but a converter saves time when you have dozens of values to migrate.

How REM To PX Conversion Works

The inverse is just as simple. Multiply the rem value by the root font size:

px = rem × root font size

So 1.25rem × 16 = 20px, 2.5rem × 16 = 40px, and 5rem × 16 = 80px. This direction is especially useful when reading third-party design systems that publish values in rem but you need a pixel preview.

Why Modern Developers Prefer REM

The web is consumed on thousands of unique combinations of devices, browsers, assistive technologies and personal settings. Hard-coded pixel values assume that every visitor is content with the designer's chosen size. Rem flips that assumption: it adapts to the user. Increase the default font size in your browser settings — a common accommodation for low-vision users — and a well-built rem layout grows with you while a px-only layout stays stuck.

Benefits Of Using REM

  • Scales automatically with user font preferences.
  • Predictable cascade — every component derives from one variable.
  • Pairs naturally with design tokens and CSS custom properties.
  • Better baseline accessibility with no extra code.
  • Easier to refactor a whole product: change the root and the layout follows.

Benefits Of Using PX

  • Pixel-perfect control for borders, hairlines and icons.
  • Useful for media query breakpoints where exact device widths matter.
  • Familiar mental model from print and Figma.
  • Works well for one-off ornamental values that should not scale.

REM vs PX

Think of pixels as a measurement and rem as a relationship. Pixels say "this element is 24 units tall". Rem says "this element is 1.5 times the root size". The second framing is more flexible because it lets the entire interface grow or shrink consistently. Use rem for typography, spacing and most sizing; reach for px when an element genuinely should not respond to user settings.

Accessibility Benefits Of REM

The WCAG guidelines recommend that text can be resized up to 200% without loss of content or functionality. Layouts built primarily with rem satisfy this requirement almost for free: when a user enlarges their default font size, every spacing token, line-height and component grows together, preserving the rhythm of the design instead of cramming oversized text into fixed pixel containers.

Responsive Design Using REM

Combining rem with clamp(), container queries and fluid typography produces layouts that feel intentional at every viewport. A common pattern looks like this:

h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 3rem); }
.section { padding-block: clamp(2rem, 5vw, 6rem); }

Because everything is rem-based, the design also honors the user's default font size on top of the viewport-driven scaling.

Examples Of PX To REM Conversion

  • 10px → 0.625rem
  • 14px → 0.875rem
  • 16px → 1rem
  • 20px → 1.25rem
  • 24px → 1.5rem
  • 32px → 2rem
  • 48px → 3rem
  • 64px → 4rem
  • 96px → 6rem

Examples Of REM To PX Conversion

  • 0.5rem → 8px
  • 0.75rem → 12px
  • 1rem → 16px
  • 1.25rem → 20px
  • 1.5rem → 24px
  • 2rem → 32px
  • 3rem → 48px
  • 5rem → 80px

Using REM In Tailwind CSS

Tailwind's default theme defines spacing in increments of 0.25rem. A class like p-4 is 1rem of padding (16px at the default root), text-base is 1rem, and text-2xl is 1.5rem. Because the entire scale is rem-based, Tailwind projects inherit accessibility benefits with no extra effort. Use this converter to translate hard-coded pixel values from a design file into the closest Tailwind utility.

Using REM In Bootstrap

Since Bootstrap 5 the framework's typography, spacing and component sizing are expressed in rem. Custom themes typically override $font-size-base and $spacer, both rem values, to rescale the system without touching every component.

Using REM In Angular Applications

Angular has no opinion about CSS units — it simply ships whatever you write. Define your design tokens as CSS custom properties expressed in rem and consume them in component stylesheets. Angular Material's typography config also accepts rem values, making it easy to keep a single source of truth.

Using REM In React Applications

React projects benefit from rem in the exact same way. Whether you write plain CSS, CSS Modules, Tailwind, styled-components or vanilla-extract, prefer rem for sizing and spacing so the entire component tree responds to one root value.

Using REM In Next.js Applications

Next.js inherits all of the above. The recommended pattern is to define a base CSS file with html { font-size: 100%; } (so the user's preference wins) and to author every component with rem. Avoid the popular "62.5%" hack — it silently overrides user settings and undermines accessibility.

Common CSS Sizing Mistakes

  • Setting html { font-size: 62.5%; } to make math easier.
  • Mixing px and rem inconsistently across a single design system.
  • Using px for media queries that should respond to font scaling.
  • Hard-coding line-heights in px instead of unitless ratios.
  • Forgetting that em compounds — nested elements multiply parent sizes.

Best Practices For CSS Units

  • Use rem for typography, spacing, radius and breakpoints.
  • Use unitless numbers for line-height.
  • Reserve px for hairline borders, focus rings and ornamental details.
  • Use % and fr for layout proportions inside grids and flex containers.
  • Use clamp() with rem for fluid, accessible typography.

Conclusion

Converting between pixels and rem is trivial math, but choosing the right unit is a design and accessibility decision that compounds across an entire product. Default to rem, keep the root font size at 16px, and use this converter whenever you need to translate a value from a design file or third-party library. Your users — especially those who depend on browser font-size settings — will thank you.

Frequently Asked Questions