FC

📐 PX ↔ REM Converter

Convert between pixel and REM units for responsive CSS. Set your base font size and convert instantly.

16px = 1rem
1rem = 16px

Conversion Table (base 16px)

pxrempxrem
8px0.5rem10px0.625rem
12px0.75rem14px0.875rem
16px1rem18px1.125rem
20px1.25rem24px1.5rem
28px1.75rem32px2rem
36px2.25rem40px2.5rem
48px3rem56px3.5rem
64px4rem72px4.5rem
80px5rem96px6rem
128px8rem
Complete Guide

📊 Key Data Points

16px default

Default browser root font-size — the standard base for rem calculations

1.5rem = 24px

Common example: 24 divided by 16 = 1.5rem at the default 16px base

Accessibility

rem respects user browser font-size preferences; px ignores them

Pixel to REM Converter -- Complete USA Guide 2026

Rem units in CSS are relative to the root html element font size (default 16px in all browsers). Designs are specified in pixels; CSS should use rem for accessibility — users who increase their browser font size benefit from rem-based layouts that scale with their preference.

This converter instantly converts px to rem (and back) with a configurable base size. Runs in your browser.

**Long-tail searches answered here:** px to rem converter with 16px base online free, convert pixels to rem for css typography, rem to px calculator configurable root font size.

For complete unit handling, see CSS Unit Converter.

🔬 How This Calculator Works

rem = px divided by base-font-size. With the default 16px base: 24px becomes 1.5rem, 16px becomes 1rem, 8px becomes 0.5rem.

The converter accepts a custom base font size if your project overrides the root font size in CSS. Batch mode: paste a list of pixel values (one per line or comma-separated) and convert all at once — useful when migrating a whole design spec from px to rem.

✅ What You Can Calculate

Batch px to rem conversion

Paste multiple pixel values at once and convert them all. Useful when migrating design tokens or a legacy stylesheet from pixel-based to rem-based sizing.

Configurable base size

Set the root font-size to match your project. If you use 18px as your base, 18px = 1rem. The converter recalculates all conversions when you change the base.

Reverse rem to px

Convert rem back to pixels for design handoff or debugging. When you see padding: 1.25rem in your CSS, enter it here to see it is 20px at 16px base.

Accessible sizing reference

Shows the rendered size in px at common browser font-size settings (100%, 110%, 125%, 150%) — demonstrating why rem values scale correctly with user preferences while px values do not.

🎯 Real Scenarios & Use Cases

Design-to-code handoff

Your designer specifies 20px padding. Convert here: 20/16 = 1.25rem. Use rem in your CSS so the padding scales when users increase their browser font size.

Tailwind design token alignment

Tailwind spacing scale uses rem: p-4 = 1rem = 16px. Convert your design spec pixel values to rem here to align with Tailwind scale.

Accessibility audit

Review your CSS for px font-size declarations. Convert them to rem here and replace — font-size: 14px becomes font-size: 0.875rem.

Verifying component sizes

A component displays incorrectly. Convert its rem values to px here to see the actual rendered size and compare against the design spec.

💡 Pro Tips for Accurate Results

Never use html { font-size: 62.5% }. This breaks user browser font-size preferences — users who set 20px as their default now get 12.5px.

Design in px, code in rem. Figma specs in px. Convert to rem for the code — accessibility benefits without changing your design workflow.

rem for font-size, em for component spacing. Common convention: rem for font sizes, em for padding and margins.

Test at 200% browser zoom. Verify your layout works when rem values are effectively doubled by browser zoom.

🔗 Use These Together

🏁 Bottom Line

Pixel-to-rem is a daily developer task. This converter handles single values and batches with configurable base sizes. For complete responsive CSS: CSS Unit Converter and Font Size Calculator.

Why convert px to rem in CSS?

rem units scale with the user's browser font size preference. If a user sets their browser to 20px base (common for low-vision users), 1rem = 20px and all rem-based text and spacing scales accordingly. px ignores this — 14px stays 14px regardless of user preference. Accessibility guidelines recommend rem for font sizes. For layout spacing (margin, padding, gap), rem also works well — everything scales proportionally when the user adjusts font size. Use px only for borders, box-shadows, and purely decorative elements that should not scale.

How does the rem calculation work?

rem = px / root-font-size. With the browser default of 16px: 24px = 24/16 = 1.5rem. 32px = 2rem. 14px = 0.875rem. If your root is set to 10px (via html { font-size: 62.5% }): 24px = 2.4rem, 16px = 1.6rem. The 62.5% trick makes conversions easier but is now considered less elegant than using a converter and keeping the default 16px root. Always check what root font size your project uses before converting.

What is the 62.5% root font size trick?

Setting html { font-size: 62.5% } makes 1rem = 10px (62.5% of the 16px browser default). This makes px-to-rem conversion trivial: 24px = 2.4rem, 16px = 1.6rem. Advantages: intuitive math, easy mental conversion. Disadvantages: pollutes the root font size (all rem-based third-party components now use a different base), considered a hack, and increasingly unnecessary with CSS calc() and this converter available. Modern projects often keep the default 16px root and use a converter or design token system instead.

Should I convert margin and padding values to rem?

Yes for most cases — scaling spacing with text size creates a more harmonious layout when users change font size. The exception: border widths, border-radius, and decorative shadows can stay in px since they should not scale with text. For responsive spacing that should change between breakpoints but not with user font preference: use CSS clamp() or viewport-relative units (vw, dvh) rather than rem. A practical rule: any spacing that directly relates to text readability (line gap, paragraph margin) should be rem. Structural spacing (grid gaps, page margins) can be either.

How do I convert an entire CSS file from px to rem?

This tool handles bulk conversion. For a terminal approach: sed 's/\([0-9]*\)px/calc(\1rem\/16)/g' styles.css (rough — needs refinement for border-radius, box-shadow, media queries). A safer approach: use postcss-pxtorem (npm package) as a PostCSS plugin that intelligently converts px to rem in your build pipeline, with a configurable root value and exclusion list for properties that should stay in px. This is the recommended approach for large codebases — add to webpack or Vite config and it handles all conversions automatically.

What is the difference between rem, em, and px for media queries?

Media queries should use rem — not px, and especially not em. Reason: browser zoom (Ctrl+) scales the viewport in px-based units but not always consistently. rem-based media queries react to the user's font size preference. If the user has a 20px base font, a 48rem breakpoint triggers at 960px instead of 768px, giving wider viewports to users who need larger text — this is the correct adaptive behavior. The Responsive Breakpoints tool on this site shows standard breakpoints in both px and rem.

What other CSS unit and sizing tools are on this site?

The CSS Unit Converter handles all CSS units (px, rem, em, vw, vh, pt, cm). The Font Size Calculator generates fluid type scales using CSS clamp(). The Responsive Breakpoints tool shows standard viewport widths in rem. The Flexbox Generator and Grid Generator use gap values that benefit from rem conversion. All are in the Dev Tools CSS section.