1 em is equal to 16 pixels (px) by default in most browsers. This means when you specify 1 em in CSS, it usually corresponds to 16px on the screen.
Table of Contents
The conversion from em to px depends on the browser’s default font size or the font size set on the parent element. Because 1 em equals the current font size, if the font size is 16px, then 1 em equals 16px. This relationship allows flexible scaling of elements relative to text size.
Conversion Tool
Result in px:
Conversion Formula
The formula to convert em to pixels is: px = em × baseFontSize. The base font size is usually 16px, set by browsers by default. Because 1 em equals the font size of the current element or its parent, multiplying the em value by the base font size gives the equivalent pixel value.
Here is how it works step-by-step:
- Identify the base font size in pixels (commonly 16px).
- Multiply the em value by this base font size.
- The result is the pixel value corresponding to the em input.
For example, converting 1 em to px:
1 em × 16 px = 16 px
Conversion Example
- Convert 2.5 em to px:
- Base font size is 16 px
- 2.5 × 16 = 40 px
- So, 2.5 em equals 40 px
- Convert 0.75 em to px:
- 0.75 × 16 = 12 px
- Therefore, 0.75 em is 12 px
- Convert 3 em to px:
- 3 × 16 = 48 px
- So, 3 em corresponds to 48 px
- Convert 0.1 em to px:
- 0.1 × 16 = 1.6 px
- Hence, 0.1 em equals 1.6 px
Conversion Chart
This chart shows values from -24.0 em to 26.0 em converted to pixels. Negative values represent sizes smaller than the base font, useful in some CSS scaling. To read the chart, find the em value in the left column and see its equivalent in px on the right.
| em | px |
|---|---|
| -24.0 | -384 |
| -20.0 | -320 |
| -16.0 | -256 |
| -12.0 | -192 |
| -8.0 | -128 |
| -4.0 | -64 |
| 0.0 | 0 |
| 4.0 | 64 |
| 8.0 | 128 |
| 12.0 | 192 |
| 16.0 | 256 |
| 20.0 | 320 |
| 24.0 | 384 |
| 26.0 | 416 |
Related Conversion Questions
- How many pixels equals 1 em in CSS?
- Is 1 em always 16 pixels or does it change?
- What happens if I change the base font size from 16px, how does 1 em convert?
- Can 1 em be different on mobile devices compared to desktop?
- Does 1 em equal 16 px in all browsers?
- How to convert 1 em to px when font size is customized?
- Is 1 em bigger than 16 px if the parent font size changes?
Conversion Definitions
em: A relative length unit in CSS, representing the computed font size of the parent element. One em equals the current font size, allowing scalable typography and element sizing. It adjusts dynamically when font size changes, making layouts flexible across devices.
px: An absolute length unit representing pixels on the screen. One pixel corresponds to a single dot on the display. Pixels provide fixed size values in CSS, ensuring consistent dimension regardless of font size or scaling, but can be less flexible for responsive design.
Conversion FAQs
Why does 1 em sometimes not equal 16 pixels?
Because 1 em equals the font size of the current context, if the base font size is changed by CSS or inherited from a parent element, 1 em will match that new size instead of 16 pixels. So, it depends on the font size set in the environment, not a fixed pixel value.
Can I use em to size elements other than text?
Yes, em units can size padding, margins, widths, heights, and other properties. Using em makes elements scale proportionally with font size, which helps maintain consistent designs especially when text size changes for accessibility or responsiveness.
How does changing the root font size affect em conversions?
Changing the root font size (usually the html element) changes the base for all em units. For example, if root font size is set to 20px instead of 16px, then 1 em will equal 20px. This impacts all em-based sizes unless overridden further down the DOM tree.
Is em better than px for responsive web design?
Em units are more flexible than px because they scale with font size and user settings, making designs adapt better across devices. Pixels are fixed, which may cause issues on high-DPI screens or user zoom scenarios. Em improves accessibility and scalability.
What happens if I use negative em values?
Negative em values can be used, but they may cause unintended effects like overlapping elements or collapsing sizes. Since em represents a length, negative values invert size or position but must be used carefully to avoid layout problems.