Px to Rem Converter
Px ↔ rem at any root font size — single values, whole CSS blocks, and a live 1–100 px table — entirely on this device.
1.5remat root 16px
Converted CSS appears here — changed lines are highlighted.
| px | rem |
|---|---|
| 1 | 0.063 |
| 2 | 0.125 |
| 3 | 0.188 |
| 4 | 0.25 |
| 5 | 0.313 |
| 6 | 0.375 |
| 7 | 0.438 |
| 8 | 0.5 |
| 9 | 0.563 |
| 10 | 0.625 |
| 11 | 0.688 |
| 12 | 0.75 |
| 13 | 0.813 |
| 14 | 0.875 |
| 15 | 0.938 |
| 16 | 1 |
| 17 | 1.063 |
| 18 | 1.125 |
| 19 | 1.188 |
| 20 | 1.25 |
| 21 | 1.313 |
| 22 | 1.375 |
| 23 | 1.438 |
| 24 | 1.5 |
| 25 | 1.563 |
| 26 | 1.625 |
| 27 | 1.688 |
| 28 | 1.75 |
| 29 | 1.813 |
| 30 | 1.875 |
| 31 | 1.938 |
| 32 | 2 |
| 33 | 2.063 |
| 34 | 2.125 |
| 35 | 2.188 |
| 36 | 2.25 |
| 37 | 2.313 |
| 38 | 2.375 |
| 39 | 2.438 |
| 40 | 2.5 |
| 41 | 2.563 |
| 42 | 2.625 |
| 43 | 2.688 |
| 44 | 2.75 |
| 45 | 2.813 |
| 46 | 2.875 |
| 47 | 2.938 |
| 48 | 3 |
| 49 | 3.063 |
| 50 | 3.125 |
| 51 | 3.188 |
| 52 | 3.25 |
| 53 | 3.313 |
| 54 | 3.375 |
| 55 | 3.438 |
| 56 | 3.5 |
| 57 | 3.563 |
| 58 | 3.625 |
| 59 | 3.688 |
| 60 | 3.75 |
| 61 | 3.813 |
| 62 | 3.875 |
| 63 | 3.938 |
| 64 | 4 |
| 65 | 4.063 |
| 66 | 4.125 |
| 67 | 4.188 |
| 68 | 4.25 |
| 69 | 4.313 |
| 70 | 4.375 |
| 71 | 4.438 |
| 72 | 4.5 |
| 73 | 4.563 |
| 74 | 4.625 |
| 75 | 4.688 |
| 76 | 4.75 |
| 77 | 4.813 |
| 78 | 4.875 |
| 79 | 4.938 |
| 80 | 5 |
| 81 | 5.063 |
| 82 | 5.125 |
| 83 | 5.188 |
| 84 | 5.25 |
| 85 | 5.313 |
| 86 | 5.375 |
| 87 | 5.438 |
| 88 | 5.5 |
| 89 | 5.563 |
| 90 | 5.625 |
| 91 | 5.688 |
| 92 | 5.75 |
| 93 | 5.813 |
| 94 | 5.875 |
| 95 | 5.938 |
| 96 | 6 |
| 97 | 6.063 |
| 98 | 6.125 |
| 99 | 6.188 |
| 100 | 6.25 |
Press ? for shortcuts
Do it offline:$ awk 'BEGIN { printf "%srem\n", 24/16 }'
How to use it
- Choose Single for one value, or Batch for a whole block of CSS.
- Type the value — a px, rem, or em suffix picks the direction, shown on the badge.
- Adjust the root font size if your stylesheet changes it; the result and the table follow.
- Pick a precision from 0 to 10 decimals.
- Copy the result, share a permalink, or download the rewritten CSS.
Type a value like 24px or 1.5rem and read the conversion instantly, at whatever root font size your stylesheet actually uses — not just the 16px default. A Batch tab rewrites whole CSS pastes, a 1–100px table covers the common sizes at a glance, and every calculation runs on this device: nothing is uploaded, no account exists.
How it works
One division or one multiplication does the work: px to rem divides by the root font size, rem to px multiplies by it. Rounding is where converters quietly disagree, so this one is explicit: 13px at a 16px root is exactly 0.8125rem, and at three decimals that tie rounds away from zero to 0.813rem — trailing zeros stripped.
em and rem multiply different bases. rem always references the document root, so a px value maps to exactly one rem value and back. em references the element's own inherited size and compounds as elements nest — 1.5em inside a 20px parent is 30px, while 1.5rem is 24px at a 16px root anywhere. Pasted em converts here as root-relative, with a chip saying exactly that: em converted as root-relative here — in CSS, em scales with the parent element's font size.
Examples
24px1.5remThe everyday case: 24 divided by the 16px root is 1.5. The px suffix set the direction; the radio group can override it.
1.125rem18pxA rem suffix flips the direction automatically: 1.125 times 16 is 18. Bare numbers stay on whichever direction is pinned.
margin: 8px 16px; font-size: 14px;margin: 0.5rem 1rem; font-size: 0.875rem;Batch converts all three px lengths in one pass — brace-less declaration lists are fine — and reports converted and skipped counts.
13px0.813remThe rounding proof: the exact quotient 0.8125 carries a tie in the fourth decimal, and half-away rounding prints 0.813 rather than 0.812.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
Any root, not just 16px
Set the root to 10 and 24px reads 2.4rem — the classic 62.5% html trick that makes 1rem equal 10px. The 1–100px table re-renders at whatever root is set.
Sub-pixel results are exact; painted pixels may not be
1.1rem converts back to 17.6px and picks up a chip — Browsers may snap fractional px to whole device pixels when painting. The arithmetic holds; the paint may not.
Unitless zero stays unitless in Batch
A bare 0 has no unit to convert, so Batch leaves it untouched and uncounted. An explicit 0px still becomes 0rem.
Batch is a masked scanner, not a CSS parser
Lengths convert only inside declaration values. Selectors such as .mt-16px, url() paths, quoted strings and comments are never rewritten; dimensions in other units — %, vh, vw — are left alone, counted and listed as skipped.
Media queries convert too
Breakpoints are value context: @media (min-width: 768px) becomes @media (min-width: 48rem) at the default root. Whether rem breakpoints suit your design is a separate decision; the rewrite is exact.
Big pastes go to a worker; 1 MB is the ceiling
Batch input beyond 200 KB runs in a background worker so typing never stalls; past 1 MB the tool refuses and names the limit rather than truncating.
Common errors
Enter a number (units px/rem/em optional)- One numeric value was not found — letters, an empty box, or a malformed 12.4.5 all land here. Casing never matters: 24PX parses.
Unsupported unit "pt" — supported units are px, rem, and em- The message names the unit you typed and highlights the suffix in place. Only px, rem and em have a defined mapping through the root.
Root font size must be a positive number of pixels- Shown inline at the root field for zero, negative or empty values. Every conversion divides or multiplies by the root, so it must be positive.
Input is larger than the 1 MB limit for this tool. For bigger stylesheets use the CLI: awk 'BEGIN { printf "%srem\n", 24/16 }'- The banner names the limit and hands over the command-line route — edit its two numbers for your own value and root.
FAQ
Why use rem instead of px?
Because rem listens to the reader. Browsers let people raise their default font size, and WCAG 2.2 success criterion 1.4.4 expects text to stay usable scaled to 200% — rem sizes inherit that scaling automatically, px sizes sit still.
What's the difference between em and rem?
Both multiply a font size; they differ in which one. rem means the document root, so a value converts identically everywhere; em means the element's own inherited size and compounds with nesting: 2em inside a 20px card is 40px, but 2rem is 32px at the default root. A pasted em value is treated as root-relative here, flagged with a chip.
What is 16px in rem?
Exactly 1rem at the browser's default root, since 16 divided by 16 is 1. Change the root and the answer moves: at a 10px root, 16px is 1.6rem. The table above lists 1–100px at the root currently set.
Keyboard shortcuts
- ⌘/Ctrl + Enter
- Re-run the conversion (results already update as you type).
- ⌘/Ctrl + C
- Copy the converted value while nothing is selected — focused number inputs keep their native copy.
- ⌘/Ctrl + Shift + C
- Force-copy the result even when a selection exists.
- ⌘/Ctrl + S
- Download the Batch output as converted.css instead of the browser's save-page dialog.
- s
- Swap the conversion direction (inactive while a field has focus).
- t
- Cycle the color theme.
- ? or ⌘/Ctrl + /
- Open the keyboard help for this page.
- Esc
- Dismiss the open dialog.