CSS Unit Converter — px, rem, em, pt, %

Enter a value in any CSS length unit and read it back in px, rem, em, pt and percent — or pick a single pair such as px to rem or em to px. Set the root and parent font-size to match your project, or paste a whole stylesheet to convert every px value. Everything runs in your browser.

Root drives rem. Parent drives em and %. Both default to 16px, the browser default.

What you can do here

Pick a pair from the list under the tool, or choose Convert to in the menu. Each pair has its own address, such as /css-unit-converter?mode=px-to-rem or ?mode=point-to-em, so you can bookmark the one you use most.

How each unit resolves

UnitRelative toFormula from px
pxNothing — it is the absolute reference. One CSS pixel is 1/96 of a CSS inch, independent of screen DPI.—
remThe root font-size (the font-size on <html>), 16px by default.px / root
emThe current element's font-size — in practice the parent's, for properties other than font-size itself. Compounds when nested.px / parent
ptA fixed ratio: CSS defines 1in = 72pt = 96px, so 1pt ≈ 1.333px.px × 0.75
%For font-size, the parent's font-size. For other lengths, a measurement of the containing block. This tool uses the parent font-size.px / parent × 100

When to use rem vs em

Reach for rem by default. It is anchored to one number — the root font-size — so 1.5rem is the same everywhere on the page and your spacing scale stays predictable. Reach for em when you want a value to track its local context: padding of 0.75em inside a button grows automatically if that button's font-size grows, and a 1.2em line spacing follows whatever text it wraps. The trade-off with em is compounding — nest three elements that each set font-size: 0.9em and the innermost text is 0.9 × 0.9 × 0.9 ≈ 0.73 of the outer size.

Accessibility: rem and the user's font-size

Browsers let people raise the default font-size in their settings, and that changes what 1rem resolves to. A layout built in rem — type, margins, padding, max-widths — scales up with that preference, so the page stays proportional and readable. The same layout hard-coded in px ignores the setting entirely. Keep font sizes and generous spacing in rem; px is fine for hairline borders, shadows, and 1px details that should not scale.

Common px values

Assuming a 16px root and 16px parent (the browser default):

pxremempt%
40.25rem0.25em3pt25%
80.5rem0.5em6pt50%
100.625rem0.625em7.5pt62.5%
120.75rem0.75em9pt75%
140.875rem0.875em10.5pt87.5%
161rem1em12pt100%
181.125rem1.125em13.5pt112.5%
201.25rem1.25em15pt125%
241.5rem1.5em18pt150%
322rem2em24pt200%
483rem3em36pt300%
644rem4em48pt400%

The classic 62.5% trick sets html { font-size: 62.5% } so 1rem = 10px and the arithmetic gets easier. It works, but it forces every third-party component that assumes a 16px root to be re-tuned, so most design systems now keep the 16px root and let this kind of converter do the math.

Formulas for every unit pair

R is the root font-size and P the parent (reference) font-size, both 16px by default. 1pt = 4/3 px, so dividing by 0.75 turns points into pixels.

ConversionFormulaExample (R = P = 16)
px to rempx / R24px = 1.5rem
rem to pxrem × R1.5rem = 24px
px to empx / P14px = 0.875em
em to pxem × P1.5em = 24px
px to ptpx × 0.7516px = 12pt
pt to pxpt / 0.7512pt = 16px
px to %px / P × 10020px = 125%
% to px% / 100 × P150% = 24px
rem to emrem × R / P1rem = 1em (0.8em if P = 20)
em to remem × P / R1em = 1rem (1.25rem if P = 20)
rem to ptrem × R × 0.751.5rem = 18pt
pt to rempt / 0.75 / R12pt = 1rem
em to ptem × P × 0.752em = 24pt
pt to empt / 0.75 / P9pt = 0.75em
rem to %rem × R / P × 1001.25rem = 125%
% to rem% / 100 × P / R87.5% = 0.875rem
em to %em × 1001.2em = 120%
% to em% / 10075% = 0.75em
pt to %pt / 0.75 / P × 10012pt = 100%
% to pt% / 100 × P × 0.75150% = 18pt

Worked examples: em to px and px to em

em depends on the font-size where it is used, so the same number gives different pixels in different places:

ValueReference (parent) sizeResult
1em16px16px
1.5em16px24px
0.875em16px14px
1.5em20px30px
24px16px1.5em
18px20px0.9em

Watch for compounding: if a component sets font-size: 1.25em on itself and then uses padding: 1em, the padding is measured against the enlarged size. Convert against the font-size that will actually be in effect at that point in the tree, not against 16 by habit.

Converting a whole stylesheet from px to rem

The Convert a stylesheet tab rewrites every length in the unit you choose. With a 16px root, this:

.card { padding: 24px 16px; font-size: 18px; border: 1px solid #e2e8f0; }

becomes:

.card { padding: 1.5rem 1rem; font-size: 1.125rem; border: 1px solid #e2e8f0; }

1px hairlines stay in px by default, because a border that scales to 1.25px at a larger font-size tends to render blurry. Colors such as #e2e8f0 and unitless numbers are never touched.

Questions

How many pixels is 1rem?

1rem is the root font-size — 16px in every browser by default. Divide px by the root to get rem: 24 / 16 = 1.5rem.

rem vs em?

rem is always relative to the root font-size and never compounds. em is relative to the current element's font-size and compounds when nested. Use rem for predictable type and spacing, em for values that should scale with local context.

How do I convert px to pt?

CSS fixes 1in = 96px = 72pt, so 1px = 0.75pt and 16px = 12pt. It does not depend on screen DPI.

What does % resolve to?

For font-size, a percentage of the parent's font-size: 120% of 16px is 19.2px. Other length properties take a percentage of the containing block. This tool uses the parent font-size you set.

px or rem for accessibility?

Use rem for font-size and scalable spacing so the layout follows a visitor's chosen default font-size. Keep px for borders and 1px details.

What reference size should I enter when converting em to px or px to em?

The computed font-size in pixels of the element the em value sits on — 16 for unstyled body text, or whatever a parent has set. The same 1.5em is 24px inside a 16px element but 30px inside a 20px one.

How do I convert pt to rem or rem to pt?

Go through pixels. pt to rem: divide by 0.75, then by the root size, so 12pt = 16px = 1rem. rem to pt: multiply by the root size, then by 0.75, so 1.5rem = 24px = 18pt.