Custom web fonts are the most common cause of bad first impressions on otherwise-fast sites. The page renders quickly, then waits. Then text appears, sometimes shifting visibly into place. The cost is real — measurable in both Core Web Vitals and conversion rates — and the fix is unglamorous: a small set of CSS, build, and server changes that most teams ship and forget.
This guide is about those changes. The terms FOUT and FOIT show up a lot; the underlying problem is the same; the solutions converge once you understand the mechanics.
What's Actually Happening
When a browser encounters CSS that uses a custom font, it has to fetch the font file before it can render text in that font. Without explicit guidance, browsers handle this differently:
- FOIT (Flash of Invisible Text) — the browser hides the text until the font loads. The page is blank where text should be. This was Chrome's default behavior for years; it produced the worst LCP scores because the text was "painted" only after the font arrived.
- FOUT (Flash of Unstyled Text) — the browser shows fallback text immediately, then swaps in the custom font when it loads. Text is readable from the first paint; the swap is visible.
FOIT looks cleaner during the brief loading state, but FOUT is much better for perceived performance and accessibility. Every modern strategy is built on top of FOUT or a controlled variant of it.
The font-display Property
The single most important CSS property for font loading is font-display. It tells the browser how to behave during the gap between page load and font load.
Four values matter:
block— short invisible period (FOIT), then fallback. Closest to the old bad default.swap— fallback immediately, swap in custom font when loaded (FOUT).fallback— short invisible, then fallback briefly, then custom font if it loads in time. Otherwise stick with fallback.optional— fallback immediately, only use custom font if it is already cached. The most conservative.
@font-face {
font-family: 'Inter';
src: url('/fonts/inter.woff2') format('woff2');
font-display: swap;
}
For most sites, swap is the right default. It guarantees text is visible from first paint and the custom font appears as soon as it can. The visible swap is a small UX cost in exchange for a large performance and accessibility win.
For body text that you want to avoid the swap on, optional is a stronger choice — if the font isn't already cached, the user gets the fallback for that page load, but no swap interrupts reading.
Preloading
A font that the page needs for above-the-fold content should be requested as early as possible. By default, the browser discovers the font only after parsing the CSS that references it. A <link rel="preload"> in the HTML head tells the browser to fetch it immediately.
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>
Three details matter:
as="font"is required. Without it, the browser doesn't know how to prioritize the request.crossoriginis required for fonts, even from your own origin. Without it, the preload is ignored and the font is fetched again later.type="font/woff2"is recommended but optional. It lets the browser skip preloading for formats it doesn't support.
Preload only the fonts you actually need above the fold. Preloading every font defeats the purpose by competing with other critical resources for early bandwidth.
Subsetting
Font files often contain thousands of glyphs covering many languages and characters. Most pages need only a fraction — basic Latin characters and maybe a few accented forms. Shipping the full font wastes bandwidth.
Subsetting strips the file to the characters actually used:
pyftsubset inter.woff2 \
--unicodes="U+0020-007F,U+00A0-00FF" \
--output-file=inter-latin.woff2
This produces a Latin-only variant — typically 1/3 to 1/2 the size of the original. For sites that use only basic Latin, this is a substantial saving with no visible difference.
For sites with multilingual content, the answer is multiple subsets and Unicode-range partitioning in CSS:
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-latin.woff2') format('woff2');
unicode-range: U+0000-00FF;
font-display: swap;
}
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-cyrillic.woff2') format('woff2');
unicode-range: U+0400-04FF;
font-display: swap;
}
The browser fetches only the subset it needs based on the characters on the page.
Variable Fonts
A variable font is a single file containing multiple weights and styles as parameterized variations. Instead of shipping inter-regular.woff2, inter-bold.woff2, inter-light.woff2, you ship one inter-variable.woff2 that contains all weights.
The net file size of a variable font is usually slightly larger than any one weight but much smaller than several weights combined. For a site that uses three or more weights of a font, variable fonts are a clear win.
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-variable.woff2') format('woff2-variations');
font-weight: 100 900;
font-style: normal;
font-display: swap;
}
The font-weight: 100 900 declares the supported range. CSS that says font-weight: 600 produces text at that weight from the variable file.
Self-Hosting vs Font CDNs
Google Fonts and similar CDNs were once the default. They are still convenient. They are no longer faster than self-hosting for most sites.
Reasons to self-host:
- Fewer DNS lookups and TLS handshakes. Every external origin adds connection setup time.
- Better cache control. You set the cache headers; the CDN's defaults may not match your deployment patterns.
- Privacy regulation. GDPR and similar regimes have increasingly held that third-party font CDNs are a data-sharing concern. Self-hosting eliminates the issue.
- No third-party dependency. Font CDN outages do happen. Your fonts go down with them.
The operational cost of self-hosting fonts is essentially zero — they are static assets on your CDN. The migration is a few hours of work for most sites. Some teams keep a font CDN for the convenience of variant negotiation; most should self-host.
Size Adjust
A recent CSS feature, size-adjust, lets you tune fallback font metrics so the swap is less visible. Define a fallback font with size-adjust to match the metrics of your custom font:
@font-face {
font-family: 'Fallback-Inter';
src: local('Arial');
size-adjust: 107%;
ascent-override: 90%;
descent-override: 22%;
line-gap-override: 0%;
}
body {
font-family: 'Inter', 'Fallback-Inter', sans-serif;
}
The fallback font is rendered at adjusted metrics that approximate the custom font's. When the swap happens, the text barely moves. The visual jolt of FOUT is minimized.
Tools like fontaine and similar build steps generate the size-adjust values automatically by reading the custom font's metrics.
What to Avoid
A few patterns that consistently produce bad outcomes:
font-display: blockon body text. Hides text for up to 3 seconds while waiting for the font. Worst Core Web Vitals impact.- Loading 6+ font variants. Each is a separate request. Use variable fonts or pick a smaller variant set.
- Loading fonts via
@importin CSS. Adds a level of indirection that delays font discovery. Use<link rel="preload">or direct@font-facein the main stylesheet. - Skipping
font-displayentirely. Default behavior varies by browser. Always setfont-displayexplicitly.
Each of these is common in pre-optimized sites and trivially fixable.
A Practical Starting Setup
For a site with no explicit font optimization today:
- Audit which fonts and weights are actually used. Trim what isn't.
- Switch to variable fonts where you use 3+ weights.
- Self-host the fonts (move off Google Fonts unless there is a specific reason to stay).
- Add
font-display: swapto every@font-facedeclaration. - Preload the one or two fonts used above the fold.
- Subset to the character ranges you actually use.
- Optionally: add
size-adjustfallback metrics to minimize swap visibility.
This is a half-day project for a typical site and substantially improves LCP and CLS scores.
Fonts dragging your Core Web Vitals scores? We help teams design font-loading strategies that match modern browser capabilities and user-experience tradeoffs. scopeforged.com