Dev Tools

Pixel to Em Converter

Convert between px, em, rem, pt, and percentage CSS units instantly. Adjust the base font size and view a full conversion table.

Quick Answer

With a 16px base: 1em = 1rem = 16px = 12pt = 100%. Enter any value below to convert between all CSS units.

px16px
em1em
rem1rem
pt12pt
%100%

Common Sizes (base: 16px)

pxem / rempt%
8px0.56pt50%
10px0.6257.5pt62.5%
12px0.759pt75%
14px0.87510.5pt87.5%
16px112pt100%
18px1.12513.5pt112.5%
20px1.2515pt125%
24px1.518pt150%
28px1.7521pt175%
32px224pt200%
36px2.2527pt225%
40px2.530pt250%
48px336pt300%
56px3.542pt350%
64px448pt400%
72px4.554pt450%
80px560pt500%
96px672pt600%

About This Tool

The Pixel to Em Converter is an essential utility for front-end developers, UI designers, and anyone working with CSS typography and layout. It provides instant bidirectional conversion between the five most commonly used CSS length units: pixels (px), em, rem, points (pt), and percentages (%). Simply enter a value in any unit, set your base font size, and see the equivalent in all other units at a glance.

Understanding CSS Length Units

CSS offers a variety of length units, each with distinct behaviors and ideal use cases. Absolute units like pixels and points maintain a fixed size regardless of surrounding context. Relative units like em, rem, and percentage scale dynamically based on a reference value, typically the font size of a parent or root element. Understanding when and how to use each unit is fundamental to building responsive, accessible, and maintainable websites. This tool bridges the gap between these unit systems, letting you think in whichever unit feels most natural and convert to the others as needed.

Pixels: The Screen Native Unit

Pixels (px) are the most intuitive unit for screen design because they map directly to physical screen dots (though on high-DPI displays, one CSS pixel may correspond to multiple physical pixels). Designers often work in pixels because design tools like Figma and Sketch output measurements in pixels. However, using pixels exclusively in CSS can create accessibility problems, because pixel-based font sizes do not scale when users adjust their browser's default font size. This is why modern best practices recommend using rem for typography and spacing, while reserving px for borders, shadows, and other fixed-dimension properties.

Em and Rem: Relative Sizing for the Web

The em unit is relative to the computed font size of the element's parent. If a paragraph sits inside a div with font-size: 20px, then 1.5em on the paragraph equals 30px. This cascading behavior is powerful for component-level design but can become unpredictable when elements are deeply nested, since em values compound at each level. The rem (root em) unit solves this problem by always referencing the root element's font size (the html element). With a default browser font size of 16px, 1rem always equals 16px regardless of nesting depth. This predictability makes rem the preferred unit for most layout and typography work in modern CSS architectures like Tailwind CSS, which uses rem under the hood.

Points and Percentages: Special-Purpose Units

Points (pt) originate from traditional print typography, where 1 point equals exactly 1/72 of an inch. In CSS, 1pt is defined as 4/3 of a pixel (approximately 1.333px). Points are most useful in print stylesheets (@media print) where physical dimensions matter. Using points for screen styling is generally discouraged because the physical size of a point varies across different screen densities. Percentages (%) are relative to the parent element's computed value for the same property. For font-size, 100% equals the parent's font-size. For width, 100% equals the parent's content width. Percentages are essential for fluid and responsive layouts where elements need to adapt to their container size.

The Conversion Table

Below the converter, you will find a reference table showing 18 common pixel sizes converted to em, rem, pt, and percentage values based on your current base font size. This table is especially helpful when establishing a type scale for a project. For example, with a 16px base, a common heading hierarchy might use 32px (2rem) for H1, 24px (1.5rem) for H2, 20px (1.25rem) for H3, and 16px (1rem) for body text. Having these values at hand saves repeated manual calculations and reduces the chance of errors in your stylesheets. The table updates dynamically when you change the base font size, so you can instantly see how a different root size affects all your proportional values.

Practical Tips for Unit Selection

When starting a new project, establish a consistent unit strategy early. Use rem for font sizes, margins, padding, and most spacing to ensure your layout respects user accessibility preferences. Use px for borders (1px solid), box shadows, and other decorative properties where fractional scaling would create visual artifacts. Use em sparingly and intentionally, typically for component-internal spacing that should scale with the component's own font size. Use percentage for container widths in fluid layouts. This approach, combined with CSS custom properties for your base values, creates a maintainable and accessible design system that works across all screen sizes and user preferences.

Frequently Asked Questions

What is the difference between em and rem in CSS?
Both em and rem are relative CSS units, but they reference different base values. An em unit is relative to the font size of its parent element. If a parent has a font-size of 20px, then 1em inside that parent equals 20px. This means em values compound when nested: a 2em element inside another 2em element effectively becomes 4 times the root size. A rem (root em) unit is always relative to the root element's font size (the <html> element), which defaults to 16px in most browsers. This makes rem more predictable for consistent sizing across a page. Most modern CSS architectures prefer rem for typography and spacing to avoid the compounding issue of em units.
Why is the default base font size 16px?
The 16px default base font size is a convention established by early web browsers in the mid-1990s. Both Netscape Navigator and Internet Explorer set 16px as the default font size for body text, and this convention has persisted across all major browsers (Chrome, Firefox, Safari, Edge) ever since. The choice of 16px was based on readability research at typical screen resolutions and viewing distances of the era. While users can change their browser's default font size in accessibility settings, 16px remains the universal default. This is why CSS calculations using em and rem units almost always assume a 16px base. Designing with rem units respects users who have changed their browser font size for accessibility.
When should I use px vs em vs rem vs pt vs percent?
Each unit serves a different purpose. Use px (pixels) for fixed-size elements that should not scale, such as borders, box shadows, or precise image dimensions. Use rem for typography, spacing, and layout dimensions — rem scales with the user's browser font size setting, improving accessibility. Use em for component-level relative sizing, such as padding within a button that should scale with the button's font size. Use pt (points) primarily for print stylesheets, as points are a physical measurement unit (1pt = 1/72 inch) familiar to print designers. Use % (percentage) for fluid layouts where elements should be proportional to their parent container, such as responsive grid widths. Many modern CSS frameworks use rem as their primary unit with px as a fallback for borders.
How do I convert px to em manually?
The formula to convert pixels to em is: em = px / parent-font-size. For example, if the parent element has a font-size of 16px (the browser default), then 24px = 24 / 16 = 1.5em. If the parent has a font-size of 20px, then 24px = 24 / 20 = 1.2em. For rem, the formula is the same but always uses the root font size: rem = px / root-font-size. Since most browsers default to 16px, the conversion is usually: rem = px / 16. So 24px = 1.5rem. To go the other direction, multiply: px = em * parent-font-size, or px = rem * root-font-size. This converter handles all these calculations for you, including the less common pt and % conversions.
What is a point (pt) in CSS and when is it used?
A point (pt) is a typographic unit of measurement equal to 1/72 of an inch. In CSS, 1pt equals approximately 1.333 pixels (or exactly 4/3 px). Points originated in traditional print typography and have been used by typesetters for centuries. In web development, points are primarily used in @media print stylesheets to ensure text prints at the correct physical size. Using points for screen display is generally discouraged because screens have variable pixel densities (DPI), making the physical size unpredictable. However, designers who come from a print background often think in points, so this converter is useful for translating between pt and screen units like px, em, or rem.
Does changing the base font size affect rem calculations?
Yes, but only if you change the root element's font size. The rem unit always references the font-size of the <html> element. If you set html { font-size: 62.5%; } (a common trick that makes 1rem = 10px), all rem values across your site are recalculated against that new base. This is why some developers use this technique: it simplifies mental math (1.6rem = 16px, 2.4rem = 24px). However, this approach can cause accessibility issues if not handled carefully, because it overrides the user's preferred browser font size. A better approach is to keep the default 16px base and use a converter tool like this one to calculate the exact rem values you need.

Was this tool helpful?