induwara.lk
induwara.lkDeveloper · CSS

px to rem Converter — CSS px, rem, em & pt

Convert any CSS length between px, rem, em, and pt instantly. Set your own root font-size, copy the paste-ready value in one click, and use the live px→rem reference table below. Runs entirely in your browser — no signup, no upload.

By Induwara AshinsanaUpdated Jul 1, 2026
px ⇄ rem converterpx · rem · em · pt
W3C CSS units · verified
From unit
1rem
To unit

Used by rem. Browser default is 16px (:root / html).

Only affects em conversions (not in use right now).

Common px

Ready to paste

font-size: 1rem;

Pivot: 16px · round-trip cross-check passes. rem uses the root font-size; em uses the element base.

px → rem reference

pxrem
1px
2px
4px
8px
10px
12px
14px
16px
18px
20px
24px
32px
40px
48px
64px
80px
96px

17common sizes, recomputed live from the root font-size. Use rem for font-size and spacing so the layout respects a reader's browser zoom and default-size settings.

Ratios are fixed CSS constants: 1in = 96px, 1pt = 1/72in (). Nothing you type leaves your browser.

How it works

Every conversion routes through px as a pivot unit: the tool first turns your input into pixels, then turns those pixels into the unit you want. That keeps the math consistent no matter which of the four units you convert between, and it matches how a browser resolves lengths.

The two font-relative units come from the W3C CSS Values and Units Module Level 4. A rem is measured against the rootelement's font-size (the :root / html element, 16px by default), while an em is measured against the nearest element's own font-size, which is why nested ems compound. The tool exposes both bases separately so the two are never conflated:

  • from rem: px = value × rootFontSize
  • from em: px = value × elementFontSize
  • to rem: result = px ÷ rootFontSize
  • to em: result = px ÷ elementFontSize

The two absolute units use the fixed ratios defined for CSS absolute lengths: 1in = 96px and 1pt = 1/72in. Combining them gives 1pt = 96/72 px = 1.3333px and its inverse 1px = 0.75pt. Because these are constants written into the CSS specification — not rates that change — the converter is fully deterministic and never goes stale.

Results are rounded to four decimal places and trailing zeros are trimmed, so 1.5000 shows as 1.5. As an internal check, every conversion is run forwards and then backwards through the pivot; the two must agree before the answer is shown, which is the “round-trip cross-check passes” note under the result. The pt path is additionally verified through the explicit inch chain (pt ÷ 72 × 96) so both routes to px must match.

Worked examples

24px → rem at a 16px root

  1. Input: 24px, root font-size = 16px
  2. To px (already px): 24
  3. To rem: 24 ÷ 16 = 1.5
  4. Result: 1.5rem
  5. Reverse check: 1.5 × 16 = 24px ✓

12pt → px (the 12pt ≈ 16px body-copy rule)

  1. Input: 12pt
  2. 1pt = 96 ÷ 72 = 1.3333px
  3. To px: 12 × 1.3333 = 16
  4. Result: 16px
  5. Reverse check: 16 × 0.75 = 12pt ✓

30px → em, nested inside a 20px element (edge case)

  1. Input: 30px, element base font-size = 20px
  2. To em: 30 ÷ 20 = 1.5
  3. Result: 1.5em
  4. Note: the same 30px is 1.875rem at a 16px root —
  5. em depends on the element base, rem on the root.

Frequently asked questions

Sources & references

The CSS unit ratios on this page were last cross-checked against the W3C specification and MDN on 2026-07-01. These ratios are fixed CSS constants, so they are stable across browser and spec revisions.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.