PX to REM Converter

Design files hand you pixels. Rem ties those sizes to the root font size, so type still scales when someone bumps browser text settings. Set your base, type a px value, copy the rem.

Pixel to rem conversion workbench

Root font size1rem equals this many pixels on html
px

Root font size in pixels. Values between 1 and 64 are accepted.

px
rem

24 ÷ 16 = 1.5 rem

Live scale

Sample text at 1.5rem (24px at root 16)

The quick brown fox jumps over the lazy dog.

Scale table

Values at 16px root
PixelsREMCSS snippet

Stop treating 16px as sacred

Most browsers ship with a 16px root. Teams treat the number as a law. Your project already changed html { font-size } for a compact admin panel, a large-type accessibility mode, or a design system step. Convert against the root you ship, not the textbook default.

Open DevTools. Inspect html. Read the computed font-size. Put the number into the root field above. Then convert.

Figma handed you 24px. Now what?

A design file marks body copy at 16, a subheading at 24, a page title at 40. Those are screen pixels on a mock canvas. Drop the same numbers into CSS as px and users who enlarge default text in the browser get stuck. Rem rewrites each mark relative to the root:

  • 24 ÷ 16 = 1.5rem
  • 40 ÷ 16 = 2.5rem
  • 12 ÷ 16 = 0.75rem for tight captions

Change the root to 18px and those rem values still describe the same ratios. The absolute pixel size moves with the root. Ratios stay put.

How the conversion runs

Formula: rem = pixels ÷ root font size. Reverse: pixels = rem × root font size. Both fields above stay linked. Edit either side. The formula strip, live scale, and table refresh together.

Fractional rem values are normal. A 15px label on a 16px root becomes 0.9375rem. Prefer four decimal places for precision, then trim trailing zeros in production if your linter prefers shorter tokens. Browsers accept the full fraction.

Everything here runs in your browser. No upload. No account. The numbers never leave the page.

Rem vs em vs px for real layouts

UnitRelative toPick whenSkip when
remRoot (html)Global type scale, spacing tokens, media-query breakpoints tied to typeA component must scale only with its own parent font-size
emParent elementPadding or icon size inside a button that should grow with the button labelDeep nesting, where each level multiplies the last
pxAbsolute CSS pixelsHairline borders, 1px rules, shadow offsets, device-pixel-snapped chromeBody copy and vertical rhythm users expect to resize

We recommend rem for the type scale and most spacing tokens. Keep borders in px. Reach for em only inside a self-contained control where the parent font-size is the intentional scale driver. For parent-relative work, the PX to EM Converter is the better match. To reverse a rem value back to pixels while debugging, use the REM to PX Converter.

Where this converter falls short

  • No media-query math. A fluid clamp() scale needs min, preferred, and max values. Convert each stop separately, then assemble clamp yourself.
  • Root percent tricks. Setting html { font-size: 62.5% } so 1rem ≈ 10px changes the base. Enter 10 in the root field when you use the 62.5% trick, or the rem output will be wrong.
  • Zoom is not root. Browser page zoom scales everything. User font-size preference changes the root. Rem responds to the second. Px ignores both for type size.
  • Subpixel rounding. 0.0625rem steps look clean in code. Paint still snaps to device pixels, so a long stack of fractional rem margins sometimes lands a pixel off a Figma guide.

Mistakes we see every week

  1. Converting against 16 while the stylesheet sets root to 15 or 18.
  2. Using rem for a border width, then wondering why a hairline thickens when the user enlarges text.
  3. Nesting rem inside a container with a transformed font-size and expecting the rem to follow the container. Rem ignores the container. Em does not.
  4. Copying rem from a 16px root project into a 62.5% root project without recalculating.

If a value looks “almost right,” check the root first. The arithmetic is rarely the bug.

PX to REM questions people ask mid-conversion

Short answers for root size, rounding, rem versus em, and what this page does not compute.

How do I convert px to rem?

Divide the pixel value by your root font size in pixels. At a 16px root, 24px becomes 1.5rem. Set the root field to match your html font-size, type the pixel value, and copy the rem result.

What root font size should I use?

Use the computed font-size on your html element. Sixteen is the browser default, not a requirement. Compact dashboards often sit at 14 or 15. Large-type modes sit at 18 or 20. Wrong root, wrong rem.

Why does rem beat px for typography?

Rem follows the root. When a reader raises default text size in the browser, rem-based type and spacing grow with the preference. Fixed px type stays put and fights accessibility settings.

Should I use rem or em?

Use rem for the global type scale and spacing tokens. Use em when a control should scale only with its parent font-size, such as icon padding inside a button. Em compounds through nested elements. Rem does not.

Does 62.5% on html make 1rem equal 10px?

Yes when the browser default is 16px, because 62.5% of 16 is 10. Enter 10 as the root in this converter while the 62.5% trick is active. Leave the field at 16 and every rem you copy will be off by 60%.

Is my input sent to a server?

No. Conversion runs entirely in the browser. Pixel and rem values never leave your machine.