Font Loading and Performance: font-display, Preloading and Fallback Metrics
Making web fonts fast and stable: what happens while a font downloads, the five font-display values, preloading critical fonts, matching the fallback with size-adjust and metric overrides to stop layout shifts, font-size-adjust, subsetting and the Font Loading API.
kvi5hnuCode Sprout team member8 min readOn this page
A web font is a separate download, and the browser can't draw text in it until the file arrives. What happens in between decides whether visitors see invisible text, a flash of the fallback font, or a layout shift when the font swaps in. This article covers controlling that, and making fonts arrive sooner.
The loading problem
When text needs a web font that hasn't loaded:
- Invisible text (sometimes called FOIT): the browser hides the text for a while, hoping the font arrives soon. On a slow connection the page is unreadable.
- Fallback, then swap (FOUT): the browser shows the text in the fallback font, and redraws it when the web font arrives. Readable at once, but text can jump if the two fonts have different sizes, which counts toward Cumulative Layout Shift (CLS).
Fonts are also discovered late: the browser only requests a font after it has the CSS and knows some text uses it.
font-display
The font-display descriptor in @font-face chooses the strategy. Each value is a combination of a block period, when text is invisible, and a swap period, when the web font can still replace the fallback:

| Value | Block period | Swap period | Use for |
|---|---|---|---|
auto | browser's choice, usually like block | ||
block | about 3s | unlimited | icon fonts, where fallback glyphs would be meaningless |
swap | none, or nearly none | unlimited | headings and brand text that must use the font |
fallback | about 100ms | about 3s | body text: fast connections get the font, slow ones keep the fallback |
optional | about 100ms | none | body text where stability matters most |
@font-face {
font-family: "Lora";
src: url("lora.woff2") format(woff2);
font-display: swap;
}
With optional, if the font isn't ready within the first ~100ms, the page keeps the fallback for that view, so there's no swap and no layout shift. The font still downloads and is cached, so the next page uses it. Combined with preloading, optional often gets the font on first view anyway.
Preloading critical fonts
A preload tells the browser to fetch the font immediately, instead of waiting until it has parsed the CSS and laid out text:
<link rel="preload" href="/fonts/lora-regular.woff2" as="font" type="font/woff2" crossorigin>
crossoriginis required, even for fonts on the same origin, because fonts are always fetched in CORS mode. Without it, the preloaded file isn't reused, and the font downloads twice.- The
hrefmust match thesrcURL exactly. - Preload only the one or two fonts used above the fold, usually the regular body face. Every preload competes with other important resources, like the main image.
For fonts on another origin, <link rel="preconnect" href="…" crossorigin> opens the connection early. Self-hosting (article 83) avoids that extra connection altogether.
Matching the fallback font
The best way to make a swap harmless is to make the fallback font take up the same space as the web font. @font-face has descriptors that adjust any font, including a local one, so you can define an adjusted fallback:
@font-face {
font-family: "Lora Fallback";
src: local("Georgia"), local("Times New Roman");
size-adjust: 104%; /* scales the glyphs to match Lora's width */
ascent-override: 92%; /* the space above the baseline, as a % of the font size */
descent-override: 24%; /* the space below it */
line-gap-override: 0%;
}
body { font-family: "Lora", "Lora Fallback", serif; }
| Descriptor | Effect | Support |
|---|---|---|
size-adjust | scales every glyph and metric of the face | all browsers |
ascent-override, descent-override, line-gap-override | replace the font's vertical metrics, which decide line box height | Chrome and Firefox |
Tested in Chrome:
- A face defined as
local("Arial")withsize-adjust: 50%drew the 20px word "Typography" 52.3px wide, against 104.5px for plain Arial: exactly half. - A face with
ascent-override: 150%,descent-override: 50%andline-gap-override: 0%gave a 20px font a 40px line box withline-height: normal, against 23px for Arial.
The right values depend on the pair of fonts. Tools and framework plugins calculate them from the font files: they compare the average character width and the vertical metrics of the web font and the fallback. Some font services and frameworks generate these fallback faces automatically.

The overlay shows what a swap looks like: wherever red and blue separate, text would move when the web font arrives. Here size-adjust was computed as the ratio of the two measured widths; the letter shapes still differ, but the words stay where they are, so a narrower column or longer text no longer breaks lines differently after the swap.
font-size-adjust
font-size-adjust is a regular property, not a descriptor. It keeps the x-height (the height of lowercase letters) consistent across fonts, so a fallback with small lowercase letters doesn't look smaller:
body { font-family: "Lora", Georgia, serif; font-size-adjust: 0.5; } /* x-height = 0.5 × font-size */
p { font-size-adjust: from-font; } /* use the first font's own ratio */
Tested in Chrome: on Georgia, font-size-adjust: 0.5 made the 20px word "Typography" slightly wider (105.8px to 109.9px), while the computed font-size stayed 20px. The adjustment changes the used size, not the computed value, so em units aren't affected. It works in all browsers, the last being Chrome 127 in 2024.
Smaller files
- Use WOFF2, the best-compressed format.
- Subset fonts to the characters you use. A full font with many scripts can be several hundred kilobytes; a Latin subset is often 20–40KB. Split subsets with
unicode-range(article 83) so other scripts load only when needed. - Use fewer faces. Every weight and style is another file. A variable font (article 87) can replace many files with one, often smaller than three or four static files.
- Cache fonts for a long time, with file names that change when the font changes.
The Font Loading API
JavaScript can load fonts and react when they're ready:
await document.fonts.load('700 1em Lora'); // starts loading if needed, resolves when ready
document.fonts.check('700 1em Lora'); // true if usable now, without loading
await document.fonts.ready; // resolves when pending loads are done
const face = new FontFace('Brand', 'url(/fonts/brand.woff2)', { weight: '400', display: 'swap' });
document.fonts.add(await face.load());
Tested in Chrome: document.fonts.load() resolved with the matching face, and document.fonts.check() then returned true. Use the API for canvas text, which needs the font before drawing, or to add a class when fonts are ready.
body { font: 0.85rem system-ui, sans-serif; margin: 1rem; }
.target, .fallback { font-size: 1.25rem; margin: 0.6rem 0 0; padding: 0.3rem 0.4rem; inline-size: fit-content; }
.target { font-family: "Courier New", Courier, monospace; background: #dbeafe; }
.fallback { font-family: "Adjusted", serif; background: #f4efe6; }
.note { color: #555; }
The bottom line is a fallback face made from a local font with size-adjust, created through the Font Loading API so the slider can change it. Real projects calculate the value once and write it in @font-face.
What's current
font-displayworks everywhere.size-adjust: all browsers;ascent-override,descent-overrideandline-gap-override: Chrome and Firefox, not yet Safari.font-size-adjustwithfrom-font: all browsers.- Variable fonts (article 87) reduce the number of files needed.
Common questions
Which font-display value should I use?
swap for headings and brand text, with a size-matched fallback; optional or fallback for body text where avoiding shifts matters; block only for icon fonts.
Why does my preloaded font download twice?
The <link rel="preload"> is missing crossorigin, or its URL doesn't exactly match the src URL.
How do I stop the layout shift when the font loads?
Use a fallback face with size-adjust and the metric overrides tuned to the web font, or use font-display: optional.
Should I preload every font? No. Preload the one or two most important files; preloads compete with other critical downloads.
Summary
- Until a web font arrives, text is either invisible or shown in a fallback; swapping can shift the layout.
font-displaysets block and swap periods:block,swap,fallback,optional.- Preload critical fonts with
as="font",typeandcrossorigin. - Define an adjusted fallback face with
size-adjust,ascent-override,descent-overrideandline-gap-overrideto remove shifts. font-size-adjustkeeps x-heights consistent across fonts.- Use WOFF2, subsets and fewer faces; the Font Loading API handles fonts from JavaScript.
Practice questions
Write a preload for /fonts/inter-var.woff2.
Answer
<link rel="preload" href="/fonts/inter-var.woff2" as="font" type="font/woff2" crossorigin>
A news site wants body text to never jump, even if the web font is slow. Which font-display value fits, and what's the trade-off?
Answer
optional. If the font isn't available within about 100ms, the page keeps the fallback, so nothing shifts; the trade-off is that first-time visitors on slow connections may not see the web font until the next page.
What does this face do, and how is it used?
@font-face {
font-family: "Body Fallback";
src: local("Arial");
size-adjust: 107%;
}
Answer
It defines a new family, "Body Fallback", that is Arial scaled up by 7%. Put it in the stack between the web font and the generic, font-family: "Body Web", "Body Fallback", sans-serif, so the fallback text takes up about the same space as the web font.
After adding font-size-adjust: 0.5 to a paragraph, its text looks slightly bigger, but getComputedStyle() reports the same font-size. Why?
Answer
font-size-adjust changes the used font size so the x-height is half the font size. The computed font-size doesn't change; only the size the glyphs are drawn at.
Previous: Web Fonts: @font-face, Formats, unicode-range and Multiple Styles

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.