Font Converter

Font Display Swap: Complete Guide

Master the font-display CSS property to control how fonts load and render. Learn when to use swap, fallback, optional, and block values.

Key Takeaways

  • swap: Best for most cases. Shows fallback immediately and swaps when ready
  • fallback: Short block period (100ms), limited swap window
  • optional: Best for slow connections. May skip custom font entirely
  • block: Hides text briefly. Use sparingly for icon fonts

Understanding FOIT and FOUT

Both FOIT and FOUT create poor experiences for users, but they manifest differently. The FOUT and FOIT solutions guide covers advanced techniques for eliminating both problems beyond the font-display property alone. The font-display property is declared inside @font-face rules; optimizing those declarations is covered in the @font-face optimization guide.

FOIT (Flash of Invisible Text)

Browser hides text while font loads. Users see blank space.

FOUT (Flash of Unstyled Text)

Browser shows fallback font, then swaps to custom. Users see a shift.

font-display Values

Recommended

font-display: swap

Zero block period, infinite swap period. Shows fallback immediately.

@font-face {
  font-family: 'CustomFont';
  src: url('/font.woff2') format('woff2');
  font-display: swap;
}

font-display: fallback

Short block (~100ms), short swap (~3s). Balanced approach.

font-display: fallback;

font-display: optional

Very short block (~100ms), no swap. Browser decides based on connection speed.

font-display: optional;

font-display: block

Long block (~3s). Use only for icon fonts where fallback would show wrong characters.

Warning: Causes FOIT. Invisible text hurts LCP.

Comparison Chart

ValueBlockSwapBest For
swap0msInfiniteMost text
fallback~100ms~3sBrand fonts
optional~100msNonePerformance-first
block~3sInfiniteIcon fonts

Preventing Layout Shift

Using swap causes FOUT which can trigger CLS. Use size-adjust to match fallback metrics. For users relying on assistive technology, font loading behavior also matters since screen readers encounter text as the page renders. The screen reader font compatibility guide explains how font loading affects accessibility. Applying these techniques correctly in production also benefits from a solid CSS foundation; the CSS font implementation guide provides a complete reference for structuring your font declarations.

@font-face {
  font-family: 'CustomFont-Fallback';
  src: local('Arial');
  size-adjust: 105%;
  ascent-override: 90%;
}

Additional Resources

Optimize Your Fonts

Generate optimized @font-face CSS with font-display included.

Generate CSS
Sarah Mitchell

Written & Verified by

Sarah Mitchell

Typography expert specializing in font design, web typography, and accessibility

Font Display Swap FAQs

Common questions about font-display CSS property