Font loading describes how a browser handles text while a custom web font is still downloading. FOIT (Flash of Invisible Text) hides the text until the font arrives. FOUT (Flash of Unstyled Text) shows text in a fallback font first, then swaps.
Why it matters
Invisible text delays reading and can hurt FCP and LCP when the text is the main content. A swap avoids the blank period but can shift the layout, which hurts CLS if the fonts have different metrics. The font-display descriptor in @font-face controls the trade-off.
Example
@font-face {
font-family: "Inter";
src: url("/fonts/inter.woff2") format("woff2");
font-display: swap;
}
Values: swap shows fallback text at once and swaps later. block allows a short invisible period. optional uses the web font only if it loads very quickly, and otherwise keeps the fallback, avoiding shifts. Preload the one or two key fonts and use WOFF2.
Common mistakes
- Leaving
font-displayunset, which usually gives a block period of up to about three seconds. - Loading six weights when two are used.
- Preloading fonts without
crossorigin, causing a double download. - Ignoring fallback font metrics, which produces large shifts on swap.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.