Under The Hood
frontend browser CSS Fonts Module Level 4

Font Rendering: FOUT vs FOIT, font-display, and Metric Overrides

Last updated
Prerequisites:
CSS @font-face rules
Browser Critical Rendering Path
  • browser
  • fonts
  • fout
  • foit
  • font-display
  • performance
  • cls

Read at your depth

The practical view

Flash of Invisible Text (FOIT) happens when the browser hides text while downloading a web font (default `font-display: block` with a 3-second invisible timeout). Flash of Unstyled Text (FOUT) happens when the browser immediately renders a fallback system font and swaps to the custom font once loaded (`font-display: swap`). Use `font-display: optional` for the fastest performance without layout shifts.

The same idea in other frameworks

react equivalent
`next/font` generating zero-CLS fallback `@font-face` metric overrides.

Legacy vs modern

Default FOIT Blocking vs Metric-Overridden FOUT Swap

Default fonts leave text invisible for seconds; metric overrides allow instant reading with zero layout shift on swap.

before → after
Default Blocking Font (FOIT)
@font-face { font-family: 'Brand'; src: url('font.woff2'); } /* ❌ Invisible text for 3s */
Metric-Overridden FOUT (Zero-CLS)
font-display: swap; size-adjust: 102%; ascent-override: 95%; // ✅ NEW

Interview gotchas

Context

Interviewers test your precision regarding Core Web Vitals optimization and low-network conditions.

The mechanical answer

`font-display: swap` gives a 0ms block period and an infinite swap period: the fallback font renders immediately and will *always* swap when the web font downloads (even if it takes 10 seconds). `font-display: optional` gives a tiny 100ms block period and a **0ms swap period**: if the web font is already in cache, it uses it; if not, it uses the fallback font for the entire life of the page and caches the web font for subsequent page loads, guaranteeing **zero layout shift**.

Trap

`font-display: optional` can result in the web font not displaying on the first visit if the network roundtrip exceeds ~100ms.

Under The Hood — a multi-depth technical interview hub.

Third-party licenses Press ⌘ K to search.