LeadReef

Convert px to em and back

Type a pixel value and get em instantly, based on the parent font size.

em = px ÷ parent font size · base 16px

Free · No sign-up · Works instantly in your browser

How it works

  1. Step 1

    Enter a value.

    Type a number in either field and the other one updates instantly.

  2. Step 2

    Set the base or DPI.

    Change the base font size or DPI if your project uses a different one.

  3. Step 3

    Copy the result.

    Copy the value or CSS, or pick a ready value from the table below.

Free PX to EM converter

em is relative to the font size of the parent element. If a button's text is 16px, 1em inside it is 16px; if the text is 20px, 1em is 20px. That makes em handy for padding and icons that should grow with their own text.

To convert, divide pixels by the parent font size: 18px ÷ 16 = 1.125em. Because em compounds when elements are nested, set the parent size above to the real font size of the element you're styling.

Common values at 16px

Click any value to copy it

Questions people ask

How do I convert px to em?

Divide the pixel value by the parent element's font size. With a 16px parent, 18px ÷ 16 = 1.125em. Set the parent size above to match your element.

Why does em change inside nested elements?

Each em is relative to its parent's font size, so a 1.2em element inside another 1.2em element ends up 1.44 times the base. This compounding is the main reason teams prefer rem for type.

em or rem for padding?

Use em for padding that should scale with the element's own text, like buttons and badges. Use rem for layout spacing that should stay consistent across the page.

What is 1em in px?

1em equals the font size of the parent element. With the browser default, that's 16px.

Last updated: 25 Nov 2026 · Made by the LeadReef team

Find local businesses that need a new website

LeadReef finds businesses with an outdated or missing website in any city, with contacts and a ready first message. Your first search is free.

Related tools

All free tools
px to remType a pixel value and get rem with any base font size.rem to pxConvert rem to pixels with any base font size.px to ptPixels to points and back, for print and documents.px to inchesPixels to inches for print and screen at any DPI.PNG to WebPSmaller files, same look, transparency kept.Aspect ratio calculatorFind a ratio, or the missing width or height.