PX to REM Converter

Convert CSS pixels (px) to root-relative rem units—or rem back to px—using a 16px default or any custom base font size. Includes one-click copy and a live reference scale.

Standard browser default is 16px.
Live CSS Output
1.5rem

24px ÷ 16px root = 1.5rem

Quick Reference Table (updates with Root Font Size)
Pixels REM CSS Snippet

Runs entirely in your browser. Nothing you enter is uploaded or stored.

Rate this tool

Be the first to rate this tool

How to use the PX to REM Converter

  1. Enter a pixel value in the Pixels box to calculate REM, or type in the REM box to calculate pixels.
  2. Adjust Root Font Size if your stylesheet sets a custom html font-size (default is 16px).
  3. Click Copy REM or Copy PX to copy the formatted CSS value.
  4. Use the live reference table below to check common spacing and typography sizes.

How PX to REM Conversion Works

In CSS, 1rem equals the font size of the root <html> element, which defaults to 16px in every major browser. To convert pixels to rem, divide your pixel value by the root font size: rem = px ÷ root.

To convert rem back to pixels, multiply instead: px = rem × root. For example, 24px ÷ 16px = 1.5rem, and 0.875rem × 16px = 14px.

Why Use REM Instead of PX?

  • Accessibility: When users increase their default browser font size for readability, rem-based typography and spacing scale cleanly with their preference.
  • Consistent design systems: Using a 4px (0.25rem) or 8px (0.5rem) rhythm keeps headings, padding, and gaps proportional across components.
  • Predictable nesting: Unlike em, which compounds inside nested containers, rem always references the root element.

Examples

  • 12px at 16px root → 0.75rem
  • 16px at 16px root → 1rem
  • 24px at 16px root → 1.5rem
  • 32px at 16px root → 2rem

PX to REM Converter FAQ

What is the default root font size in browsers?

Chrome, Firefox, Safari, and Edge all default to a 16px root font size unless overridden in user settings or CSS.

What is the 62.5% root font-size trick?

Setting html { font-size: 62.5%; } makes 1rem equal 10px (62.5% of 16px), so 18px becomes 1.8rem. You can set Root Font Size to 10 in this tool to match that setup.

Should I use rem for borders and hairlines?

Thin 1px or 2px borders are usually kept in px so they stay crisp on screen, while font sizes, padding, and margins work best in rem.

Does this converter work offline in the browser?

Yes. All calculations run directly in JavaScript with no server calls.

Related tools

All Developer Tools
JSON Formatter & ValidatorBeautify, minify and validate JSON with clear error messages.Base64 Encode / DecodeEncode or decode Base64 for text and files, UTF-8 safe.Compare Two ListsFind differences, common items, and unique entries between two text lists.Cron Expression GeneratorBuild cron schedules with simple menus, or paste any cron expression to explain it in plain English and see the next 5 run times.Diff CheckerCompare two texts and see every added, removed and changed line, with word or character highlights, side by side or unified.HEX to RGB ConverterConvert HEX color codes to RGB, RGBA and HSL and back, with a live swatch, color picker, alpha control and copy-ready CSS.JSON to CSVConvert a JSON array to CSV with nested objects flattened into dot-named columns, comma, semicolon or tab delimiters and a live preview.JSON to ExcelConvert a JSON array to a real Excel .xlsx spreadsheet or CSV, with nested objects flattened into dot-named columns and a live preview.Regex TesterTest JavaScript regular expressions live: highlighted matches, capture and named groups, indices, flags and a replace preview.Unix Timestamp ConverterSee the current Unix epoch time live, convert timestamps in seconds, milliseconds or microseconds to dates, and dates back to timestamps.URL Decode & EncodeDecode or encode URLs and query strings (percent-encoding), with + as space option and a query parameter table.Typing TestMeasure your typing speed in words per minute and your accuracy with 30 or 60 second tests.GCF CalculatorFind the greatest common factor of two or more whole numbers, with prime factorization, Euclidean steps and every common factor.