Skip to content
OddsockLocal
Local
Input unit
Root font size (px)
Parent font size (px)

px24

rem
1.5
em
1.5
px: 24Runs in this browser. Nothing is uploaded.

Ready

How to use

  1. Enter the value and choose whether you typed px, rem, or em.
  2. Set the root font size. 16 is the usual browser default.
  3. Set the parent font size. Use the root again if the element does not change font size.
  4. Read px, rem, and em. Copy the unit the stylesheet actually uses.

What is px, rem and em?

A rem is a pixel count divided by the root font size. An em is the same pixel count divided by the parent font size. With both sizes at 16, 24px is 1.5rem and 1.5em, so the two units look identical and people treat them as twins. They stop matching the moment the parent is not the root.

Read more

Type the value in px, rem, or em. The page always prints all three. If the input is already rem, it multiplies by the root to recover pixels, then divides by the parent for em. A 24px margin on a 16px root is 1.5rem. Put that same 24px inside a component whose font size is 20px and the em becomes 1.2 while the rem stays 1.5.

Root and parent are both required because they answer different questions. Rem tracks the document, which is why a user who enlarges the root text scales rem-based spacing with it. Em tracks the element you are inside, which is why a button with font-size 14px makes 1em equal 14px even when the root is 16.

Use cases

  • A front-end developer converting a 24px Figma space into rem for a 16px root.
  • A designer checking an em padding inside a card whose font size is 18px, not 16.
  • Someone moving a stylesheet off raw pixels before a browser zoom audit.
  • A student seeing why 1.5rem and 1.5em only match when parent and root match.
  • A component author publishing spacing that should follow the parent font, not the page.

24 pixels on a 16 pixel root and parent

Value 24. Input unit px. Root font size 16. Parent font size 16.

px 24, rem 1.5, em 1.5. They match because both font sizes are 16.

Why use Oddsock

Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.

Related tools

Using this tool

Divide the pixels by the root font size. 24 / 16 is 1.5rem. To go back, multiply the rem by the root.