Font Size Converter

Convert CSS font sizes between px, rem, em, pt, vw, and percentage. Set your root/base font size for accurate em/rem conversions.

Related Tools

Frequently Asked Questions

What is the difference between px, em, and rem?

px is an absolute pixel value. em is relative to the current element's font size (1em = 100% of parent). rem is relative to the root (html) element font size — typically 16px. rem is recommended for accessible, scalable typography.

What is the default browser font size?

Most browsers default to 16px. This means 1rem = 16px, 1em (from root) = 16px, and 1.5rem = 24px in a default environment.

When should I use pt instead of px?

pt (points) is a print unit — 1pt = 1/72 inch. Use pt for print stylesheets (@media print). For screen design, use px, rem, or em instead.

Font Size Units in CSS: px, rem, em, and When to Use Each

Typography is one of the most impactful elements of web design, and font size is its most fundamental property. CSS provides several units for specifying font sizes — pixels (px), root em (rem), em, viewport width (vw), and percentage — each with different behaviors and implications for responsive design, accessibility, and maintainability. Choosing the right unit for font sizing is not merely an aesthetic decision; it directly affects how your content scales, adapts to user preferences, and performs across different devices and screen sizes.

Pixels: Absolute and Predictable

Pixels (px) are the most intuitive unit for web developers transitioning from print design or working with fixed-layout designs. A pixel is an absolute unit — 16px will always render as 16 physical pixels on a standard resolution display, regardless of the parent element's font size or the root document's settings. This predictability makes pixels easy to reason about and match precisely to design specifications.

However, using pixels for font sizes has a significant accessibility drawback: it overrides the user's browser font size preferences. When a user with low vision sets their browser's default font size to 20px (larger than the default 16px) to make text more readable, pixel-defined font sizes ignore this preference and render at the specified pixel value anyway. This is why accessibility guidelines and modern CSS best practices generally recommend against using px for font sizes and instead favor relative units that respect user preferences.

rem: The Modern Standard for Font Sizes

The rem unit (root em) is relative to the font size of the root HTML element. By default, browsers set the root font size to 16px, so 1rem equals 16px, 1.5rem equals 24px, and 0.875rem equals 14px. If a user or developer changes the root font size, all rem-based measurements scale proportionally. This is the key advantage of rem: it creates a consistent scaling system tied to a single reference point, making it easy to implement site-wide font size changes with a single CSS rule.

The standard pattern for working with rem is to set a base font size on the root element — often 62.5% (which makes 1rem equal 10px for easier mental math), though this practice is becoming less common due to its own accessibility implications — and then define all font sizes in rem. More modern approaches leave the root font size at the browser default of 16px and work directly in rem fractions. The Tailwind CSS framework uses this approach: text-sm is 0.875rem, text-base is 1rem, text-lg is 1.125rem, and so on.

em: Contextual and Compositional

The em unit is relative to the font size of the element's parent (or the element itself for properties like letter-spacing). This makes em powerful for component-based design: if a card component has a font size of 1.25rem, all em-based measurements within it automatically scale relative to that component's base size. A heading within the card defined as 1.5em will be 1.5 times the card's font size, not the document root size.

The challenge with em is compounding: nested elements all multiply their parent's em size, which can lead to unexpected results in deeply nested structures. A list item inside a paragraph inside a div, each with font-size: 1.2em, would render text at 1.2 × 1.2 × 1.2 = 1.728 times the root size — nearly double. This compounding effect makes em less predictable than rem for general font sizing, though it remains excellent for spacing properties like margin, padding, and line-height where proportional scaling relative to the local font size is exactly what you want.

Viewport Units and Fluid Typography

Viewport-relative units like vw (viewport width) allow font sizes to scale fluidly with the browser window size. Setting font-size: 4vw means the font size is always 4% of the viewport width — on a 1200px wide screen it is 48px, on a 400px mobile screen it is 16px. This approach creates truly fluid typography that adapts continuously to screen size without any media query breakpoints.

The modern CSS clamp() function combines fluid scaling with minimum and maximum bounds: font-size: clamp(1rem, 2.5vw, 2rem) ensures the font size is at least 1rem, scales fluidly between that and 2rem, and never exceeds 2rem. This eliminates the need for multiple breakpoint overrides and produces smooth, proportional scaling across all viewport sizes. The clamp() approach to fluid typography is increasingly the recommended pattern for headings and display text.

Accessibility and Font Size Best Practices

The WCAG 2.1 accessibility guidelines specify that text should be resizable up to 200% without loss of content or functionality. Using rem for font sizes ensures that when a user increases their browser's base font size, all rem-based text scales proportionally. This is a baseline accessibility requirement for any public-facing website. Body text of 1rem (16px default) is the recommended starting point, with content that needs to remain legible at small sizes — such as captions and footnotes — no smaller than 0.75rem (12px default).

Line height is equally important for readability and should be set as a unitless multiplier — typically 1.5 for body text — rather than a fixed pixel value. A unitless line height scales with the font size automatically, maintaining consistent visual spacing as text size changes. Pairing rem-based font sizes with unitless line heights and em-based letter spacing creates a robust typographic system that remains readable and well-spaced across all sizes and user preferences, from the smallest mobile screen to large desktop monitors with accessibility settings enabled.

Converting Between Units in Practice

When working with design specs that specify sizes in pixels, converting to rem is straightforward: divide the pixel value by the root font size (16px by default). A 24px heading becomes 1.5rem, a 14px caption becomes 0.875rem. Keeping a conversion table handy — or using a font size converter tool — speeds up this mental math significantly. When inheriting a codebase that uses pixels and migrating to rem, the conversion is mechanical but important for accessibility. Replacing every px font-size with its rem equivalent transforms a fixed-size layout into one that respects user preferences without changing its visual appearance at default settings.