Understanding CSS Units: PX, REM, EM, and PT
CSS offers multiple unit systems for specifying sizes, each with different behavior and use cases. Pixels (px) are the most familiar, representing a single dot on the screen. However, on high-density displays (Retina, HiDPI), a CSS pixel may correspond to multiple physical pixels. Despite this abstraction, px remains an absolute unit because its rendered size does not change based on user preferences or parent element sizes.
REM (root em) is a relative unit tied to the root element's font size, which browsers set to 16px by default. When a user changes their browser's default font size for accessibility, all REM-based values scale proportionally. This is critical for users with low vision who may set their base font to 20px or 24px. If your site uses REM for typography, padding, and margins, the entire layout adapts gracefully. If you use px, the text stays fixed and may become unreadable.
REM vs EM: The Compounding Problem
While both REM and EM are relative units, they reference different things. REM always refers to the root element's font size, making it consistent everywhere in the document. EM refers to the font size of the current element's parent. This means EM values compound when nested. A paragraph set to 1.2em inside a div also set to 1.2em renders at 1.44x the root size (1.2 times 1.2). Add another nesting level and it becomes 1.728x. This compounding effect makes EM difficult to manage in deep component trees.
Modern CSS best practices recommend REM for most sizing needs because of its predictability. EM still has valid uses, particularly for components that should scale relative to their own font size, such as icon spacing within buttons or padding that should grow proportionally with text. The key is to choose intentionally: use REM when you want consistency with the root, and EM when you want proportionality with the local context.
Points and Print Design
Points (pt) originate from print typography, where 1 point equals 1/72 of an inch. In CSS, 1pt equals 1.333px (or equivalently, 1px equals 0.75pt). Points are primarily useful when creating print stylesheets or generating PDFs from HTML. For screen design, pixels and rems are more appropriate. However, understanding the pt conversion is valuable when translating designs from tools like Adobe InDesign that use point-based typography.
The 62.5% Base Font Trick
Some developers set html { font-size: 62.5%; } to make the root font size 10px, simplifying mental math: 1.6rem becomes 16px, 2.4rem becomes 24px. While this makes conversion trivial, it introduces problems. Third-party components that assume the standard 16px base may render too small. Screen readers may also misinterpret the intent. The safer approach is to keep the default 16px base and use this converter to find the correct REM values.
Accessibility and Responsive Typography
The Web Content Accessibility Guidelines (WCAG) Success Criterion 1.4.4 requires that text can be resized up to 200% without loss of content or functionality. Using REM units satisfies this requirement naturally because browser font-size settings scale REM values. Fixed pixel values for text fail this criterion because they prevent user scaling. Beyond compliance, responsive typography using REM creates a better reading experience across devices, from large desktop monitors to small phone screens.
Frequently Asked Questions
What is the difference between PX and REM?
PX is an absolute unit that stays fixed. REM is relative to the root font size (default 16px) and scales when users change browser settings, making it better for accessibility.
Why use REM instead of PX?
REM respects user accessibility preferences. When users increase their browser font size, REM layouts scale proportionally while PX layouts stay fixed.
What is the default base font size?
All major browsers default to 16px. This means 1rem = 16px unless the root font size is changed.
What is the difference between REM and EM?
REM references the root element's font size and is consistent everywhere. EM references the parent element's font size and compounds when nested.
How do I convert PX to REM?
Divide the pixel value by the base font size. With the default 16px base: 24px / 16 = 1.5rem.
Save your results & get weekly tips
Get calculator tips, formula guides, and financial insights delivered weekly. Join 10,000+ readers.
No spam. Unsubscribe anytime.