font-display: swap Explained: Stop Invisible Text While Fonts Load

Performance Analyzer

What is this warning?

An @font-face rule on the page has no font-display descriptor, so the browser uses its default and can hide text for up to about three seconds while the web font downloads. font-display: swap shows the text in a fallback font immediately and swaps in the web font when it arrives.

How to Fix This Issue

How to Fix It

What font-display does

When a page uses a web font, the browser has to decide what to show before the font file arrives. The font-display descriptor in @font-face controls that decision. It divides the font's loading time into a block period, when text using the font is invisible, and a swap period, when text is shown in a fallback font and replaced once the web font loads.

Without font-display, the browser uses auto, which in current browsers behaves like block. The result is a flash of invisible text (FOIT): headings and body copy stay blank until the font downloads or a timeout of about three seconds passes.

The five values

ValueBlock periodSwap periodUse it for
autoBrowser default (usually like block)Browser defaultNothing; set a value explicitly
blockShort (about 3s)InfiniteIcon fonts, where fallback glyphs would be wrong
swapExtremely short (about 100ms or less)InfiniteBrand and heading fonts that must eventually appear
fallbackExtremely short (about 100ms)Short (about 3s)Body text: use the web font only if it arrives soon
optionalExtremely short (about 100ms)NoneBody text where layout stability matters most

The timings are the values the CSS Fonts specification recommends; browsers may differ slightly.

What bseoa flags

bseoa reads the page's inline <style> blocks and reports this warning when an @font-face rule doesn't include font-display. Rules in external stylesheets need the same fix.

@font-face {
  font-family: 'Brand Sans';
  src: url('/fonts/brand-sans.woff2') format('woff2');
}

How to fix it

Add font-display to every @font-face rule:

@font-face {
  font-family: 'Brand Sans';
  src: url('/fonts/brand-sans.woff2') format('woff2');
  font-display: swap;
}

For Google Fonts, add the display parameter to the stylesheet URL. Google then writes the descriptor into every @font-face rule it serves:

<link rel="stylesheet"
      href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap">

If you self-host fonts loaded by a framework (Next.js next/font, Fontsource, a theme), check its font-display option. Many default to swap, but not all.

Does font-display: swap improve LCP?

Often, yes. Largest Contentful Paint measures when the largest element in the viewport is rendered, and on text-heavy pages that element is frequently a heading or paragraph. Text hidden during the block period isn't painted, so a slow font delays LCP. With swap, the fallback text paints almost immediately, and that paint counts.

The trade-off is layout shift. When the web font replaces the fallback, differences in character width and line height can move content and add to Cumulative Layout Shift. Two ways to reduce it:

  • Preload the one or two fonts used above the fold so the swap happens early, ideally before first render: <link rel="preload" href="/fonts/brand-sans.woff2" as="font" type="font/woff2" crossorigin>.
  • Adjust the fallback font's metrics to match the web font with the size-adjust, ascent-override and descent-override descriptors, so the swap barely moves anything.
@font-face {
  font-family: 'Brand Sans Fallback';
  src: local('Arial');
  size-adjust: 104%;
  ascent-override: 92%;
}

body {
  font-family: 'Brand Sans', 'Brand Sans Fallback', sans-serif;
}

The right percentages depend on the two fonts. Tools such as Fontaine and next/font calculate them automatically.

Which value should you use?

Use swap for most web fonts. Use optional for body text when you'd rather keep the fallback than risk a visible shift on slow connections. Keep block for icon fonts only. Serving the fonts as WOFF2 and preloading the critical ones makes every option behave better; see font not in WOFF2 format and LCP text missing font-display.

SEO Impact

This issue can affect your site's search engine rankings and user experience. Addressing it promptly helps ensure optimal performance and visibility in search results.

Automatic Detection

bseoa automatically checks for this warning during site analysis, along with hundreds of other technical SEO issues.

Other Performance Analyzer issues

Ready to Unlock Your Site's Full SEO Potential?

Choose the license that fits your needs and start getting the deep, actionable insights you deserve.