The font-display descriptor tells the browser what to show while a web font is still downloading. With font-display: swap, the browser draws the text immediately in a fallback font and swaps in the web font as soon as it arrives, so readers never stare at invisible text. That is why css font-display swap is the usual choice for body text.
Without it, many browsers hide text for up to about three seconds (the "flash of invisible text", or FOIT). This guide explains the loading timeline, each font-display value, how to pick one, and how to reduce the layout shift that swapping can cause.
When the browser finds text that needs a web font, it starts downloading the font file. During the wait it moves through up to three phases, called periods:
The font-display value decides how long each period lasts. The default value, auto, lets the browser choose, and most browsers use a block period of around three seconds. On a slow connection that means a blank headline, which hurts both readers and perceived speed.
font-display is a descriptor inside @font-face, not a property you set on elements:
If you load fonts from Google Fonts, adding &display=swap to the stylesheet URL makes Google emit this descriptor for you.
| Value | Block period | Swap period | Typical use |
|---|---|---|---|
auto | Browser decides | Browser decides | Rarely best; avoid |
block | Short (about 3s) | Infinite | Icon fonts, brand text that must not show a fallback |
swap | Very short (about 100ms or less) | Infinite | Body text and headings |
fallback | Very short (about 100ms) | Short (about 3s) | Text where a late swap would be jarring |
optional | Very short (about 100ms) | None | Non-critical fonts; the browser may skip the download |
The exact times are recommendations in the CSS Fonts specification, and browsers may tune them. What matters is the shape: swap always ends up using the web font, fallback gives up on a swap after a few seconds, and optional only uses the font if it is already available quickly.
swap for most text. Content shows at once and the brand font appears when ready.fallback when the layout jump from a late swap would hurt, for example a long article already being read.optional for decorative fonts. On the first visit the page may stay in the fallback, and later visits use the cached font with no swap at all.block only when a fallback would be wrong, such as an icon font where the fallback shows meaningless letters. Modern projects usually replace icon fonts with SVG.A swap can reflow text if the fallback and web font have different widths and heights. That shows up as cumulative layout shift (CLS). You can reduce it by adjusting the fallback to match the web font with descriptors in a second @font-face:
The percentages here are examples; tools such as the font metrics calculators in popular frameworks compute the right numbers for each font pair. Measure the result, because the correct values depend on the specific fonts.
Pair font-display with a preload for the one font used above the fold, so the download starts earlier:
The crossorigin attribute is required even for same-origin fonts, because fonts are fetched in anonymous CORS mode. Preload only one or two files; preloading everything competes with other critical resources.
Both show fallback text quickly. swap will replace it whenever the font arrives, however late. fallback only swaps if the font arrives within a short window of about three seconds, otherwise the fallback stays.
Yes. Add display=swap (or fallback, optional, block) to the css2 URL and Google writes the matching font-display into its @font-face rules.
The fallback and web font have different metrics. Pick a similar fallback and use size-adjust and the override descriptors to match them.
Only if you accept that some first-time visitors will see the fallback. It gives the best stability, but the brand font may not appear on the first page view.
Set font-display inside @font-face so text is never invisible while a web font loads. Use swap for most text, fallback or optional when stability matters more than the exact font, and block rarely. Preload the critical file and tune fallback metrics to limit layout shift.