Skip to main content
ToolsHub

PX ↔ REM Converter

Enter a pixel or rem value and base font size to convert between units instantly, with a reference table for common values.

Updated

Files never leave your browser

Conversion is instant and runs locally — nothing is uploaded.

Result

1rem

Reference table (base 16px)

PixelsREM
8px0.5rem
12px0.75rem
14px0.875rem
16px1rem
18px1.125rem
20px1.25rem
24px1.5rem
32px2rem
48px3rem
64px4rem

How to use PX ↔ REM Converter

The PX to REM Converter converts pixel values to rem units and rem back to px for responsive CSS design, with a configurable root font size (default 16px). It includes a reference table of common conversions so you can quickly look up the rem equivalent of any pixel value while coding. Conversion is instant and runs locally with no uploads.

  1. Choose the conversion direction: PX → REM or REM → PX.
  2. Enter the value you want to convert in the input field.
  3. Adjust the base font size if your project uses a root font size other than 16px.
  4. The converted value appears instantly below the input.
  5. Refer to the reference table for common px/rem pairs at the selected base size.

Your data never leaves your device — 100% private processing.

Why use rem instead of px in CSS

CSS pixels (px) are absolute units: 16px is always 16px regardless of user preferences. rem (root em) is relative to the root element font size (html { font-size }), which browsers default to 16px but users can change in their accessibility settings. Using rem for font sizes, spacing, and layout means that users who increase their browser font size for readability get proportionally larger UI — critical for meeting WCAG accessibility guidelines. px is appropriate for values that should never scale (border widths, shadows, fine lines) but should be avoided for text, padding, and layout dimensions. The common convention of setting html { font-size: 62.5% } makes 1rem = 10px (easy mental arithmetic), but this requires resetting all inherited text sizes.

Common px to rem conversions (base 16px)
PixelsREMTailwind class (approx)
8px0.5remtext-xs / p-2
12px0.75remtext-sm
14px0.875remtext-base (Tailwind)
16px1remtext-base / p-4
18px1.125remtext-lg
20px1.25remtext-xl
24px1.5remtext-2xl / p-6
32px2remtext-4xl / p-8
48px3remtext-5xl
64px4remtext-6xl

em vs rem — when to use each

em is relative to the font-size of the element itself (or its nearest ancestor with a font-size set), while rem is always relative to the root html element. This makes rem predictable: 2rem is always twice the root font size no matter how deeply nested the element is. em is useful for component-relative spacing — padding: 1em on a button scales proportionally if the button's font-size changes, keeping the button proportions consistent. The classic problem with em is compounding: nested elements each multiply their parent's font size, so three levels of 1.2em produces 1.2 × 1.2 × 1.2 = 1.728rem. Use rem for global spacing and typography scales; use em for component-internal spacing that should scale with the component's text size.

Worked examples

24px to rem

Inputs: 24px · base 16px

Result: 1.5rem

rem to px

Inputs: 1.25rem · base 16px

Result: 20px

Custom base (62.5%)

Inputs: 24px · base 10px

Result: 2.4rem

Glossary

rem
Root em — a CSS relative unit equal to the font-size of the root html element (default 16px in most browsers).
em
A CSS relative unit equal to the current element's font-size; compounds with nesting, unlike rem.
Root font size
The font-size set on the html element; typically 16px by default in browsers but can be changed by users or stylesheets.
Viewport units
CSS units vw and vh representing 1% of the viewport width/height; used for fluid layout alongside rem.
WCAG
Web Content Accessibility Guidelines — the international standard for web accessibility; requires that text can be resized by users without loss of content.

Related reading

Free · No spam

Get weekly tool tips & updates

New tools, power-user tips, and productivity hacks — delivered free every Friday.

No spam, ever. Unsubscribe with one click.

Related Developer Tools

Explore all Developer Tools.