Skip to content
← Typography Tools

Font Loading Strategy

Generate the exact @font-face declarations, preload tags, and font-display values that ship fast without flashing or shifting.

Related Tools

Related Tool
Font Stack Builder
Related Tool
Optical Size Adjuster
Related Tool
Google Fonts Explorer
Related Tool
CSS Tools

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 toolfont-displayText invisible forWeb font still swapped in if it arrives…
no-fallbackblockup to about 3 s (short block period)at any time
brand-perfectswapabout 100 ms at mostat any time (can shift the layout late)
balancedfallbackabout 100 msonly within about 3 s, then the fallback stays
performanceoptionalabout 100 msonly 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/.

CheckOld outputGenerator now
Bold text with a static regular fileOne rule, font-weight: 100 900: bold drawn with the regular file, 555.2 px wide, same as regularOne rule per file (400, 700): bold uses the bold file, 564 px = the bold file on its own (564 px)
format() hintAlways format("woff2")From the extension (.woff2, .woff, .ttf, .otf); none if unknown, with a warning
Fallback while the font loadsNoneA "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 average0.59%
Height change of a 600 px paragraph when Lato arrivesPlain Arial: 6.2 px on average0.0 px

Frequently Asked Questions

What is the difference between FOIT and FOUT?
FOIT is Flash of Invisible Text, where the browser hides text completely while waiting for a web font to load. The block phase of font-display: block causes this. FOUT is Flash of Unstyled Text, where the browser shows fallback text immediately and swaps to the web font when it arrives. font-display: swap causes this. FOUT is generally preferred because content is always readable; FOIT can hide the page during slow loads.
Which font-display value should I pick?
swap for headlines and brand-critical text where readability matters more than visual consistency; fallback for body text, so slow connections keep the fallback; optional for fonts that are not essential; block almost never. In the tool, the four use-case buttons set these values.
How does preload affect critical path?
A preload starts the font download as soon as the HTML is parsed instead of after the CSS is read and the browser finds text that needs the font, so the font can arrive before first paint. How much that saves depends on the page and the connection. Preloaded files compete with CSS and images for bandwidth, so preload the one or two files the first screen needs, never the whole family.
Do I need crossorigin on the preload tag?
Yes, always. Web fonts are loaded as cross-origin resources even when self-hosted, because the CSS @font-face spec treats them that way. Without crossorigin on the preload tag, the browser downloads the font twice: once for the preload (mode no-cors) and once for the actual font request (mode cors). Adding crossorigin to the preload tag makes them match.
Should I self-host or use Google Fonts CDN?
Browsers now partition their HTTP cache by site (Chrome since version 86; Safari keys it by the top-level site), so a font cached from fonts.gstatic.com on another site is not reused on yours; the shared-cache argument for the CDN is gone. Self-hosting removes the connection to a second origin and lets you ship only the files you use; the Google Fonts CDN is simpler to set up and serves subsets automatically. Measure both on your own page if the difference matters.
What is unicode-range and should I use it?
unicode-range tells the browser to download a file only if the page uses characters in that range; it is how Google Fonts splits families into latin, latin-ext, cyrillic and other files. Use it only if your file really is such a subset. The generator includes Google's latin and latin-ext ranges, copied from its CSS API.
Will font-display: optional skip my font on every reload?
No, only while the font is not cached. optional gives the font a very short block period (about 100 ms); if the file is not ready, the page keeps the fallback and the browser still finishes the download, so on later page views it is usually available from cache and used at once.
Does font-display work with variable fonts?
Yes, the same way: font-display belongs to the @font-face rule, not to the file. For a variable font, choose Variable in the tool and enter the weight range the file actually covers; the rule gets font-weight: min max, and an optional second rule for an italic file.