Ensure text remains visible during webfont load

Fonts are often large files with slow load times. Some browsers hide text until the font loads, causing a flash of invisible text (FOIT).

How the Lighthouse font-display audit fails

Lighthouse flags any font URLs that may flash invisible text:

A screenshot of the Lighthouse Ensure text remains visible during webfont loads audit

How to avoid showing invisible text

The easiest way to avoid showing invisible text while custom fonts load is to temporarily show a system font. By including font-display: swap in your @font-face style, you can avoid FOIT in most modern browsers:

@font-face {
  font-family: 'Pacifico';
  font-style: normal;
  font-weight: 400;
  src: local('Pacifico Regular'), local('Pacifico-Regular'),
  font-display: swap;

The font-display API specifies how a font is displayed. swap tells the browser that text using the font should be displayed immediately using a system font. Once the custom font is ready, it replaces the system font. (See the Avoid invisible text during loading post for more information.)

Preload web fonts

Use <link rel="preload" as="font"> to fetch your font files earlier. Learn more:

Google Fonts

Add the &display=swap parameter to the end of your Google Fonts URL:


Browser support

Browser Support

  • 60
  • 79
  • 58
  • 11.1


Stack-specific guidance


Specify @font-display when defining custom fonts in your theme.


Specify @font-display when defining custom fonts.