ZapKit

px to rem Converter

Convert pixel sizes from a design file into rem units for CSS, or rem back into pixels, for one value or a whole list.

What is a px to rem converter?

Designs in Figma, Sketch or Adobe XD are measured in pixels, but modern CSS often uses rem units so text and spacing scale with the reader's font settings. A px to rem converter does the division for you, using your site's root font size.

Front-end developers use it to translate a design system's type scale and spacing tokens into CSS, Tailwind or design tokens. Paste a whole list of sizes, get a table of rem values with their percentage of the root, and convert the other way when you need to know how big a rem value renders.

How to use the px to rem Converter

  1. 1.Choose the direction

    px to rem, or rem to px.

  2. 2.Paste your values

    One or many, with or without the px or rem unit.

  3. 3.Check the root size

    16px unless your site changes the html font size.

Example: a type scale at 16px

Seven sizes from a design file, with the default 16px root:

12px / 14px
0.75rem / 0.875rem
16px
1rem
18px / 24px
1.125rem / 1.5rem
32px / 48px
2rem / 3rem

rem = px ÷ root font size

The whole scale converts in one step, ready to paste into a stylesheet.

Why rem instead of px

A rem is relative to the root element's font size. When people raise the default text size in their browser for readability, rem-based sizes grow with it while fixed pixel sizes don't, so rem makes type, spacing and layouts more accessible.

Browsers default the root font size to 16px, so 1rem = 16px and 24px = 1.5rem. Some sites set html { font-size: 62.5% } so that 1rem = 10px; enter 10 as the root size to match. em units work the same way but relative to the parent element, which compounds when nested.

Frequently asked questions

How many px is 1rem?

16px by default, or whatever the html element's font size is set to.

How do I convert px to rem?

Divide by the root font size: 24 ÷ 16 = 1.5rem.

Should I use rem for everything?

rem suits font sizes and spacing; borders and hairlines often stay in px.

What's the difference between rem and em?

rem is relative to the root font size; em is relative to the current element's font size, so nested ems multiply.

More Developer tools