The four font-display options
font-display is the CSS descriptor inside @font-face that tells the browser how to behave while a web font is loading. The four useful values are swap, fallback, optional, and block. swap shows the fallback immediately and swaps to the web font when it loads. fallback shows the fallback after 100ms then swaps if the font loads within 3 seconds. optional only uses the font if it loads in under 100ms. block hides text for up to 3 seconds waiting for the font.
swap is the most common default because it never hides text. The downside is the visual swap when the font arrives, which causes layout shift. fallback is the most performance-conscious choice for body text because it prefers the fallback if the font is slow. optional is the only choice for fonts that are not critical to the brand, because it never blocks rendering and never triggers a swap on slow connections.
When to use preload
preload is a <link> tag that tells the browser to start downloading a font as soon as the HTML is parsed, before the CSS that declares the @font-face block has even been read. This eliminates the discovery delay where the browser would otherwise wait until layout to know the font is needed.
Preload only the one or two files the first screen needs, typically the body weight and the hero weight; preloading every weight competes with CSS and images. Tick the files to preload and the generator writes each <link rel=preload> with as="font", the type that matches the file's format and crossorigin, plus the matching @font-face rules, and warns past two files.
Common Use Cases
Self-hosting a family that ships as separate static files (Lato, Open Sans static, most foundry kits): the generator writes one @font-face per weight and style so the browser picks the real bold and italic files instead of faking them. Self-hosting a variable font: one rule with the weight range the file actually covers.
Cutting the layout shift when the web font swaps in: pick a local fallback (Arial, Helvetica, Times New Roman, Georgia), give the tool your font file, and it writes a fallback @font-face with size-adjust and ascent, descent and line-gap overrides measured in your browser. If your files are Google Fonts subsets, the latin and latin-ext unicode-range values are built in, copied from Google's own CSS.
Worked example: what each choice means in time, and one trap in the output
The four use cases map to the four font-display values, whose timing CSS Fonts Level 4 defines as a block period (text invisible) followed by a swap period (fallback shown, web font swapped in if it arrives):
| Use case in the tool | font-display | Text invisible for | Web font still swapped in if it arrives… |
|---|---|---|---|
| no-fallback | block | up to about 3 s (short block period) | at any time |
| brand-perfect | swap | about 100 ms at most | at any time (can shift the layout late) |
| balanced | fallback | about 100 ms | only within about 3 s, then the fallback stays |
| performance | optional | about 100 ms | only if almost immediately available (usually from cache) |
On October 13, 2026 we tested the old output and the rebuilt generator in Chromium 141 with Lato, a family Google Fonts serves as separate static files (400 and 700 WOFF2, about 23 KB each). Scripts and results: _ops/checks/font-loading/.
| Check | Old output | Generator now |
|---|---|---|
| Bold text with a static regular file | One rule, font-weight: 100 900: bold drawn with the regular file, 555.2 px wide, same as regular | One rule per file (400, 700): bold uses the bold file, 564 px = the bold file on its own (564 px) |
| format() hint | Always format("woff2") | From the extension (.woff2, .woff, .ttf, .otf); none if unknown, with a warning |
| Fallback while the font loads | None | A "Lato Fallback" rule over local Arial: size-adjust 97.50%, ascent 101.54%, descent 21.54%, line gap 0.00%, measured from the Lato file in the browser |
| Width error vs Lato, 5 test passages (one line each) | Plain Arial: 2.74% on average | 0.59% |
| Height change of a 600 px paragraph when Lato arrives | Plain Arial: 6.2 px on average | 0.0 px |
- Static or variable decides the font-weight descriptor. A range such as 100 900 tells the browser one file covers every weight, which is only true for a variable font. With a static file it stops the browser from synthesising bold, so bold text looks regular.
- How the fallback numbers are measured. The tool loads your file with the FontFace API, lays out the opening of Pride and Prejudice in it and in the local fallback to get the width ratio (size-adjust), and reads the font's ascent, descent and line gap from the same browser; the overrides are divided by size-adjust because size-adjust scales them too (CSS Fonts 5). The test passages were different texts, so the 0.59% is not fitted to them.
- Where it helps less. Width ratios depend on the text, so expect a percent or so either way. Our Linux test machine with its default font hinting (which rounds glyph widths at fractional sizes) showed no width gain, though heights still matched; the figures above are with hinting off, as text is drawn on macOS and with Windows' DirectWrite. The fallback also has to be installed: local("Arial") finds nothing on most Linux systems, so the paragraph falls back to the next font in the stack.
- WOFF2 first. In a 500-run experiment Dornauer, Vigl and Felderer (2023) measured a median load time of 161.5 ms for WOFF2 against 172 ms for WOFF, 196 ms for OTF and 210 ms for TTF; the generator warns about non-WOFF2 files.
- Preload with crossorigin. Font requests are CORS requests, so a preload without crossorigin is not reused and the file downloads twice; keep it to the first screen's one or two files.
Sources
Checked on .
- W3C CSS Fonts Level 4: font-display (block, swap and failure periods)
- W3C CSS Fonts Level 4: font-weight descriptor ranges and font matching
- MDN: rel=preload (fonts need as="font" and crossorigin)
- MDN: size-adjust and ascent-override (matching fallback metrics to cut layout shift)
- W3C CSS Fonts Level 5: size-adjust
- Chrome for Developers: Gaining security and privacy by partitioning the cache (Chrome 86)
- Google Fonts CSS API: Lato css2 response with latin and latin-ext unicode-range (fetched Oct 13, 2026)
- Dornauer, Vigl & Felderer (2023), On the Role of Font Formats in Building Efficient Web Applications, arXiv:2310.06939