Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Convert CSS pixels to em units at any base font-size. Enter a px or em value for an instant bidirectional result, and copy the CSS in one click.
| Pixels | EM | CSS |
|---|---|---|
| 1px | 0.0625em | font-size: 0.0625em; |
| 2px | 0.125em | font-size: 0.125em; |
| 4px | 0.25em | font-size: 0.25em; |
| 8px | 0.5em | font-size: 0.5em; |
| 10px | 0.625em | font-size: 0.625em; |
| 12px | 0.75em | font-size: 0.75em; |
| 14px | 0.875em | font-size: 0.875em; |
| 16px | 1em | font-size: 1em; |
| 18px | 1.125em | font-size: 1.125em; |
| 20px | 1.25em | font-size: 1.25em; |
| 24px | 1.5em | font-size: 1.5em; |
| 32px | 2em | font-size: 2em; |
| 48px | 3em | font-size: 3em; |
| 64px | 4em | font-size: 4em; |
A PX to EM converter turns a pixel length into the CSS em unit, a font-relative length defined by the W3C CSS Values and Units Module Level 3. One em equals the font-size in effect on the element, so the conversion is a simple division by the base font-size.
For a root-relative unit that never compounds, see the PX to REM Converter, or convert the other direction with the REM to PX Converter.
The em unit is relative to the computed font-size of the element it is used on, and browsers default the root font-size to 16px. At that base, 16px equals 1em and 24px equals 1.5em.
em = px ÷ base font-size
Example: 24px ÷ 16 = 1.5em
All processing happens in your browser. No values are uploaded to any server.
| em | rem |
|---|---|
| Relative to the element's own font-size. | Relative to the root (html) font-size. |
| Compounds through nested elements. | Does not compound; stays constant. |
| Good for spacing that tracks local text size. | Good for consistent, predictable sizing. |
At the default 16px base, dividing by 16 gives the em value. For example, a 12px caption is 0.75em and a 24px subheading is 1.5em.
| Pixels | EM (base 16px) |
|---|---|
| 12px | 0.75em |
| 16px | 1em |
| 20px | 1.25em |
| 24px | 1.5em |
| 32px | 2em |
Yes, at the default base. Browsers set the root font-size to 16px, so when em resolves against a 16px font-size, 16px equals 1em. If the base font-size is different, the ratio changes.
Divide the pixel value by the base font-size in pixels. For example, 24px at a 16px base is 24 / 16 = 1.5em. This tool does the division for you and lets you set any base.
The em unit is relative to the font-size in effect on the element, not the root. An element with a 32px font-size makes 1em equal 32px, while a 12px element makes 1em equal 12px. Set the base font-size in the tool to match the element.
em is relative to the current element's font-size and can compound through nested elements. rem is always relative to the root (html) font-size, so it stays constant regardless of nesting.
Yes. The converter is bidirectional. Type a value in the em field and it multiplies by the base font-size to give pixels, so 1.5em at a 16px base becomes 24px.
em and rem scale with the user's browser font-size preference, which helps accessibility, while px stays fixed. Many teams use rem for font-size and em for spacing that should track the local font-size.
A pixel is an absolute, fixed length, while em is relative to the element's font-size. 16px stays 16px everywhere, but 1em equals whatever font-size applies, so em scales with the surrounding text and browser zoom while px does not.
No. 1em equals 16px only when the applicable font-size is 16px, which is the browser default. On an element with a different font-size, 1em changes to match it, so a 20px element makes 1em equal 20px. Set the base in the tool to check.
Yes. All processing happens in your browser with plain arithmetic. No values are uploaded to any server, and no sign-up is required.
Did you find this page helpful?
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance