What you can do here
- px to rem and rem to px
- px to em and em to px
- px to pt (point) and pt to px
- px to percent and percent to px
- rem to em and em to rem
- rem to pt and pt to rem
- em to pt and pt to em
- rem to percent and percent to rem
- em to percent and percent to em
- pt to percent and percent to pt
- All five units at once from any input
- A whole stylesheet: every
pxvalue torem,emorpt
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
| Unit | Relative to | Formula from px |
|---|---|---|
| px | Nothing — it is the absolute reference. One CSS pixel is 1/96 of a CSS inch, independent of screen DPI. | — |
| rem | The root font-size (the font-size on <html>), 16px by default. | px / root |
| em | The current element's font-size — in practice the parent's, for properties other than font-size itself. Compounds when nested. | px / parent |
| pt | A 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):
| px | rem | em | pt | % |
|---|---|---|---|---|
| 4 | 0.25rem | 0.25em | 3pt | 25% |
| 8 | 0.5rem | 0.5em | 6pt | 50% |
| 10 | 0.625rem | 0.625em | 7.5pt | 62.5% |
| 12 | 0.75rem | 0.75em | 9pt | 75% |
| 14 | 0.875rem | 0.875em | 10.5pt | 87.5% |
| 16 | 1rem | 1em | 12pt | 100% |
| 18 | 1.125rem | 1.125em | 13.5pt | 112.5% |
| 20 | 1.25rem | 1.25em | 15pt | 125% |
| 24 | 1.5rem | 1.5em | 18pt | 150% |
| 32 | 2rem | 2em | 24pt | 200% |
| 48 | 3rem | 3em | 36pt | 300% |
| 64 | 4rem | 4em | 48pt | 400% |
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.
| Conversion | Formula | Example (R = P = 16) |
|---|---|---|
| px to rem | px / R | 24px = 1.5rem |
| rem to px | rem × R | 1.5rem = 24px |
| px to em | px / P | 14px = 0.875em |
| em to px | em × P | 1.5em = 24px |
| px to pt | px × 0.75 | 16px = 12pt |
| pt to px | pt / 0.75 | 12pt = 16px |
| px to % | px / P × 100 | 20px = 125% |
| % to px | % / 100 × P | 150% = 24px |
| rem to em | rem × R / P | 1rem = 1em (0.8em if P = 20) |
| em to rem | em × P / R | 1em = 1rem (1.25rem if P = 20) |
| rem to pt | rem × R × 0.75 | 1.5rem = 18pt |
| pt to rem | pt / 0.75 / R | 12pt = 1rem |
| em to pt | em × P × 0.75 | 2em = 24pt |
| pt to em | pt / 0.75 / P | 9pt = 0.75em |
| rem to % | rem × R / P × 100 | 1.25rem = 125% |
| % to rem | % / 100 × P / R | 87.5% = 0.875rem |
| em to % | em × 100 | 1.2em = 120% |
| % to em | % / 100 | 75% = 0.75em |
| pt to % | pt / 0.75 / P × 100 | 12pt = 100% |
| % to pt | % / 100 × P × 0.75 | 150% = 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:
| Value | Reference (parent) size | Result |
|---|---|---|
| 1em | 16px | 16px |
| 1.5em | 16px | 24px |
| 0.875em | 16px | 14px |
| 1.5em | 20px | 30px |
| 24px | 16px | 1.5em |
| 18px | 20px | 0.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.