1. Home
  2. Design tools
  3. PX to REM

PX to REM

Use rem for accessible, scalable typography and spacing. Set your root size and convert either way.

Free, no sign-up. Runs in your browser: nothing is uploaded.

Free workspace included. Docs, spreadsheets, notes and tasks that save on your device. No sign-up.Take a look

How to use PX to REM

  1. Set the root font size (16 px by default).
  2. Type pixels or rem.
  3. Copy the value or use the table.

Features

  • Two-way conversion
  • Custom root size
  • Reference table
  • One-click copy

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the PX to REM is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Guide

PX to REM - sizing CSS that respects users' font settings

Designs are usually specified in pixels, but stylesheets work better in rem. A rem is a multiple of the root font size: with the browser default of 16 px, 1rem = 16 px and 1.5rem = 24 px. This converter translates in both directions for any root size, with a reference table for the values you use most.

Converting

  • Type a pixel value to get rem, or press swap to type rem and get pixels.
  • Set the root font size if your site changes it (the default is 16 px). It’s remembered for next time.
  • Copy the result with one click. Values are rounded to at most four decimals, such as 0.875rem or 0.0625rem.

Formula: rem = px ÷ root size, and px = rem × root size.

Common values at 16 px

Pixels rem Typical use
12 px 0.75rem Captions, labels
14 px 0.875rem Small text, buttons
16 px 1rem Body text
18 px 1.125rem Large body, lead text
20 px 1.25rem Small headings
24 px 1.5rem H3
32 px 2rem H2
48 px 3rem H1, hero titles

The table on the page recalculates these for whatever root size you set.

Why rem matters

Browsers let people choose a larger default font size, and many do, especially people with low vision and older readers. Font sizes written in rem scale with that setting. Sizes in px stay fixed, so the person’s preference is ignored. Page zoom enlarges both, but font-size settings are a separate, widely used preference.

Using rem for type helps meet WCAG’s Resize Text requirement and makes the whole layout scale consistently when spacing uses rem too.

When to keep px

  • Borders and hairlines: a 1 px border should stay 1 px.
  • Box shadows and small decorative details.
  • Media query breakpoints are a matter of choice; em-based breakpoints respond to font-size settings in some browsers, which can be what you want.

rem vs em

  • rem is relative to the root (html) font size, the same everywhere on the page. Predictable.
  • em is relative to the current element’s font size, so it compounds: 1.2em inside 1.2em is 1.44 times the root. Useful for padding that should grow with a button’s own text size.

The 62.5% trick

Some sites set html { font-size: 62.5%; } so 1rem = 10 px and the math becomes trivial (24 px = 2.4rem). It still respects user preferences, but body text must then be set explicitly (body { font-size: 1.6rem; }), and third-party components that expect 16 px can render too small. Keeping 16 px and converting with a tool, or defining CSS variables such as --space-4: 1rem, avoids those side effects.

A simple scale

Many design systems use multiples of 4 px for spacing: 4, 8, 12, 16, 24, 32, 48 and 64 px, or 0.25, 0.5, 0.75, 1, 1.5, 2, 3 and 4rem. Defining them once as variables keeps spacing consistent and makes the conversion a one-time job.

Who converts px to rem

  • Front-end developers turn design specs in pixels into accessible rem values.
  • Designers handing off to developers provide sizes in both units.
  • Students learn responsive and accessible CSS.
  • Teams building design systems define spacing and type scales.

A complete example: a type scale from a design file

A design uses 14, 16, 20, 24 and 32 px:

  1. Convert at a 16 px root: 0.875, 1, 1.25, 1.5 and 2rem.
  2. Define them as variables, such as --text-sm: 0.875rem.
  3. Test by changing the browser’s default font size to Large: text grows, and the layout should still hold.

Tips

  • Keep borders in px; use rem for text and spacing.
  • Agree on one root size for the whole project.

Checked against the current version of the PX to REM on .

Frequently asked questions

How do I convert px to rem?

Divide the pixel value by the root font size, which is 16 px unless your site changes it. 24 px ÷ 16 = 1.5rem, and 14 px ÷ 16 = 0.875rem.

Why use rem instead of px for font sizes?

Many people increase the default font size in their browser settings. Sizes in rem scale with that preference; sizes in px ignore it. Using rem keeps text readable for people who need it larger, which also supports the WCAG requirement that text can be resized.

What is the difference between rem and em?

rem is relative to the root (html) font size, so 1.5rem is the same everywhere on the page. em is relative to the current element's font size, so it compounds in nested elements. rem is easier to predict; em is useful for spacing that should grow with a component's own text.

Should I set html { font-size - 62.5% } to make the math easier?

It makes 1rem equal 10 px by default, so 24 px is 2.4rem. It still respects user preferences, but every component must then set its own font size, and third-party widgets that assume 16 px can look tiny. Many teams prefer keeping 16 px and using a converter or variables instead.

Why use rem instead of px?

rem scales with the user’s browser font size setting, which improves accessibility.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.