Free PX to REM Converter

Free px to rem converter: turn pixels into rem or em (and back) using any root font size, see a quick reference table and convert a whole CSS block at once.

  • No upload, 100% private
  • Instant, in your browser
  • 100% free, no signup
Loading tool…
Read the complete guideREM vs EM vs PX in CSS: Which Unit to Use and How to Convert →

About the PX to REM Converter tool

Designs arrive in pixels, but modern CSS works best in rem units. Using rem for font sizes and spacing means your layout scales when a user raises their browser’s default text size, which is important for accessibility. The catch is the constant mental division: what is 18px in rem again?

This px to rem converter does the maths both ways. Type pixels to get rem, or type rem to get pixels, using any root font size; 16px is the browser default, but many projects set 10px or 62.5% to make the numbers easier. The same calculation works for em units when you enter the parent element’s font size as the base.

A quick reference grid shows common sizes from 1px to 128px, and clicking one loads it into the converter. For bigger jobs, paste a block of CSS and every px value is rewritten as rem automatically, with an option to leave 1px borders alone and control the number of decimal places.

How to use PX to REM Converter

  1. Set the “Root / parent font size (px)”; leave it at 16 unless your site changes it.
  2. Type a value in “Pixels (px)” to see it in “REM / EM”, or the other way round.
  3. Click any tile in the “Quick reference” grid to load that size.
  4. Paste CSS into “Convert a CSS block (px → rem)” to convert every px value.
  5. Toggle “Keep 1px (borders)” and adjust “Decimal places”, then copy the result.

Features

Two-way conversion

Convert px to rem and rem back to px as you type.

Any base size

Works with 16px defaults, 10px bases, or a parent size for em calculations.

Bulk CSS conversion

Rewrite every px value in a stylesheet snippet in one go, turning 0px into 0.

Quick reference grid

23 common pixel sizes with their rem values at your chosen base.

Precision control

Choose 0 to 8 decimal places, with trailing zeros removed.

When to use it

  • Translate font sizes from a Figma design into rem-based CSS.
  • Migrate an old pixel-based stylesheet to scalable units.
  • Define a spacing scale for a design system or Tailwind config.
  • Check what a rem value from a CSS framework equals in pixels.
  • Work out em values for a component whose parent uses a different font size.

Frequently asked questions

How do you convert px to rem?

Divide the pixel value by the root font size. With the default 16px root, 24px ÷ 16 = 1.5rem.

What is the difference between rem and em?

rem is relative to the root html element’s font size, so it is the same everywhere. em is relative to the current element’s parent font size, so it compounds when nested.

Why use rem instead of px?

When users increase their browser’s default font size, rem-based text and spacing scale with it, while px values stay fixed. This helps meet accessibility guidelines.

What is the 62.5% trick?

Setting html { font-size: 62.5% } makes 1rem equal 10px at the default size, so 24px becomes 2.4rem. Set the base to 10 here to match.

Should borders use rem too?

Usually not. Hairline borders are often kept at 1px so they stay crisp, which is why the bulk converter can leave 1px values unchanged.

Related tools