Px em rem converter cropped

Result

Common values

PXEMREM

EM is relative to the parent element’s font size, so it compounds: 1.5em inside a 20px parent is 30px, and 1.5em inside that 30px element is 45px. REM is relative to the root (html) element’s font size, so 1.5rem is the same everywhere on the page — that is why REM is the safer default for layout and spacing, while EM suits things that should scale with their parent, like a button’s padding. The base font size is the root size (usually 16px); the parent font size only matters when EM is involved.

What is the PX to EM / REM Converter?

A px to em / rem converter is a tool that converts font and spacing sizes between the three CSS length units — pixels (PX), em (EM), and relative em (REM) — in any direction. Type a value, pick the unit it is in and the unit you want, set your font sizes, and the tool gives you the converted value, the working shown, and a table of common values for reference.

Why do these units need converting? Pixels are absolute: 16px is always 16 pixels. EM and REM are relative, which makes them flexible — the same 1.5rem can mean different pixel sizes on different sites, because it depends on the font size it is measured against. That flexibility is exactly why modern CSS uses them, and exactly why converting between them needs a tool rather than guesswork.

The converter handles all four directions — PX to EM, PX to REM, EM to PX, and REM to PX — with a configurable base font size for REM and a separately configurable parent font size for EM. The result updates as you type, and a “Common values” table shows the standard sizes at a glance. Everything runs in your browser, with no sign-up and nothing sent anywhere.

How to use the PX to EM / REM Converter

  1. Enter a value in the Value field. The tool starts with 16, the browser’s default font size.
  2. Pick the unit it is in from the From dropdown — PX, EM, or REM.
  3. Pick the unit you want from the To dropdown. The default conversion is PX to REM.
  4. Set the Base font size (for REM). This is the root (html) font size, and browsers default to 16px. Change it if your site sets a different root size.
  5. Set the Parent font size (for EM). This is the font size of the parent element, and it only matters when EM is involved. It also defaults to 16px.
  6. Choose the Decimal places — 0 to 4, defaulting to 2 — to control how precise the result is.
  7. Read the result on the right, together with the formula the tool used, and copy it with the Copy result button.

Worked example

Converting 16 PX to REM with the default base font size of 16px gives:

  • Result: 1rem
  • Formula shown: 16px ÷ 16px

Change the value to 24 PX and the result becomes 1.5rem (24px ÷ 16px). Now try the other direction: 1.5 EM with a parent font size of 20px gives 30px, and the tool shows its working: 1.5em × 20px = 30px. If you then put that 30px element inside another element and use 1.5em again, you get 45px — that compounding is the key difference between EM and REM, and it is why the tool keeps the two font sizes separate.

EM or REM: which one should you use?

This is the question behind the tool, so here is the short version. The tool’s own note explains it well:

REM is relative to the root element. 1.5rem means 1.5 times the root (html) font size, and that is the same everywhere on the page. If the root is 16px, 1.5rem is 24px in the header, in the footer, and inside a nested card. That predictability is why REM is the safer default for layout and spacing — margins, padding, gaps, and font sizes that should stay consistent.

EM is relative to the parent element. 1.5em means 1.5 times the font size of the element it sits inside. That is useful when something should scale with its parent — a button’s padding, for example, growing when the button’s text grows. But it compounds: 1.5em inside a 20px parent is 30px, and 1.5em inside that 30px element is 45px. Nested EMs drift away from the size you intended, which is the most common EM mistake.

Pixels are absolute. 16px is 16 pixels everywhere, on every device. They are simple and predictable, but they do not scale when a visitor changes their browser’s default font size, which is an accessibility concern. That is why modern stylesheets use REM for most sizing and keep PX for things that genuinely should not scale, such as a 1px border.

Tips for converting units well

  1. Check your root font size before converting to REM. The default is 16px, and most sites keep it — but if your stylesheet sets html { font-size: 62.5%; } (a common trick that makes the root 10px), then 16px is 1.6rem, not 1rem. Set the Base font size to your real root size or every conversion will be wrong.
  2. Remember that EM needs the parent, not the root. The Parent font size field only matters when EM is the “from” or “to” unit. If you are converting PX to REM, the parent size is irrelevant — only the base size counts. The tool keeps the two fields separate so you cannot mix them up.
  3. Use 2 decimal places for everyday work. Two places (the default) is precise enough for layout — 1.33rem rather than 1.3333333333333333rem — and keeps your stylesheet readable. Switch to 3 or 4 places only when a design demands exact fractions.
  4. Zero converts to zero, always. 0px is 0rem and 0em is 0px, whatever the font sizes are. You never need a unit on a zero value in CSS, and this tool confirms it: a zero input converts cleanly to zero. (A zero base or parent font size is refused, because dividing by zero has no answer.)
  5. Use the Common values table as a cheat sheet. The table on the right shows the standard sizes — 8, 10, 12, 14, 16, 18, 20, 24, 32px and their EM and REM equivalents at your current font sizes. It updates when you change the base or parent size, so it stays correct for your project.

Frequently asked questions

What is the difference between EM and REM?

EM is relative to the font size of the parent element, so it can compound when elements are nested. REM is relative to the font size of the root (html) element, so it is the same everywhere on the page. For most layout and spacing, REM is the safer choice; EM suits things that should scale with their parent, like padding inside a button.

What is the default base font size?

16px. That is the default font size in every major browser, and it is the value the tool starts with. If your site sets a different size on the html element, change the Base font size field to match it before converting.

Why does my EM conversion give a different answer than my REM conversion?

Because they measure against different things. EM uses the parent element’s font size; REM uses the root font size. If your parent is 20px and your root is 16px, then 24px is 1.2em but 1.5rem. The tool shows the formula it used, so you can see which size it divided by.

Can I convert EM to REM directly?

Yes — pick EM in the From dropdown and REM in the To dropdown. The tool converts through pixels in between (EM × parent size = pixels, then pixels ÷ base size = REM) and shows both steps in the formula, so nothing is hidden.

Does the tool work with decimal values?

Yes. The Value field accepts decimals (step “any”), so 13.5px converts just like 16px. The Decimal places dropdown controls how the result is rounded — 2 places by default.

Conclusion

The PX to EM / REM Converter takes the mental arithmetic out of responsive sizing: any direction, your own base and parent font sizes, the working shown, and a table of common values for quick reference. Try converting 16px to REM above, then test a size from your own stylesheet. And to check how those sizes actually look at different screen widths, the Responsive Preview Tester on this site lets you preview any page at phone, tablet, laptop, and desktop sizes.

Related Tools