How-to guide

How to convert px to rem for CSS

Press ⌘K with TabCmdr and type 24px to rem to get 1.5rem, based on a 16px root. If your root font size is different, add it at the end: 24px to rem at 10.

Quick answer

Convert px to rem in three steps

  1. ⌘K

    Step 1

    Open the palette

    Ctrl+K on Windows and Linux. Works on any page.

  2. 24px to rem

    Step 2

    Type the size

    The rem value shows at the top of the list.

  3. ↵

    Step 3

    Press Enter

    The value is copied, ready to paste into your CSS.

How px and rem relate

A rem is the font size of the page’s root element, usually <html>. A common browser default is 16px, but people can change it in their settings and your CSS can set its own. So to turn pixels into rem, divide by the root size: 24px at a 16px root is 1.5rem.

An em works the same way, but it’s relative to the font size of the element itself, which usually comes from its parent.

Source: MDN’s CSS length units page, checked in October 2026.

TabCmdr's way

Convert px to rem in the TabCmdr palette

TabCmdr is a keyboard launcher that lives in your browser. Its search box does the division for you, so you don’t need a converter tab open while you write CSS.

Before you start: add TabCmdr from the Chrome Web Store. It has a 7-day free trial and needs no account.

Step 1: Open the palette

Press ⌘+K on a Mac or Ctrl+K on Windows and Linux, on any page.

Step 2: Type the size and the unit you want

Type 24px to rem. The answer, 1.5rem, shows under Calculator at the top of the list. TabCmdr uses a 16px root unless you tell it otherwise.

TabCmdr palette with 24px to rem typed and the answer 1.5rem under Calculator
24px to rem gives 1.5rem with a 16px root.

Step 3: Press Enter to copy

The answer row is already highlighted. Press Enter and TabCmdr copies the value and closes the palette, ready to paste into your stylesheet. A “Copied 1.5rem” message shows at the bottom of the page.

Use your own root size

If your site sets a different root font size, add it at the end with at, base or @:

TabCmdr palette with 24px to rem at 10 typed and the answer 2.4rem under Calculator
With a 10px root, 24px to rem at 10 gives 2.4rem.
You typeYou get
24px to rem at 102.4rem
24px to rem @ 102.4rem
32px to rem base 201.6rem
14px in rem0.875rem
1.5rem to px24px
18px to em1.125em
2em to px32px

em is worked out from the same base as rem, so check that your parent element’s font size matches before you use the result.

If no answer shows up

  • The number has no unit. 24 to rem doesn’t say what to convert from. Write 24px to rem.
  • The unit isn’t px, rem or em. These three are the CSS sizes TabCmdr converts. For other units, like 12 inches to cm, see the calculator page.

Try it on your own tabs

Works in Chrome, Edge, Brave, Arc, Vivaldi and Opera.

Install for Chrome

FAQ

Questions about px and rem

More in the documentation.

How do I convert px to rem?

Divide the pixels by the root font size. With the common 16px root, 24px is 1.5rem. In TabCmdr, type 24px to rem and press Enter to copy 1.5rem.

What if my root font size isn't 16px?

Add your root size at the end with at, base or @. 24px to rem at 10 gives 2.4rem and 32px to rem base 20 gives 1.6rem.

How do I convert rem back to px?

Swap the units: 1.5rem to px gives 24px.

Does it work for em?

Yes, 18px to em gives 1.125em. TabCmdr works out em from the same 16px base, or the base you give, so the answer is right when the parent element’s font size matches that base.

One shortcut for your whole browser. Stop hunting for tabs.

Free for 7 days Then $3.99 / y No account