The performance cost of web fonts depends not only on file size, but also on when the browser discovers them, when it starts downloading them, and how text is displayed in the meantime. Without preload, the browser generally needs to retrieve styles, build the CSSOM, and confirm that the current layout needs a font before downloading it. External stylesheets can therefore delay font requests. Large font files may affect First Contentful Paint (FCP), while the choice of font-display also affects text display and visual shifts when fonts change.
Discovering a font declaration does not mean downloading it immediately
@font-face defines a font’s name and file location, but the presence of a declaration does not mean the browser will download it. As web.dev explains, the browser checks whether the current page layout needs the font to avoid wasting bandwidth on unused files.
For example, if a stylesheet declares Open Sans and specifies it for headings, the browser retrieves the corresponding file only after confirming that the page’s headings need that font. If the declaration is in external CSS, the browser must first download the stylesheet to discover the font’s location. This is one reason fonts may start loading relatively late.
Inline declarations enable earlier discovery, but other CSS may still cause a wait
Placing render-blocking CSS containing @font-face in the HTML head eliminates the need to wait for an external stylesheet before discovering the declaration. However, earlier discovery does not guarantee an immediate download: if other render-blocking CSS remains in external files, the browser still needs to wait for those styles to load.
- Inline declarations preserve on-demand downloading, retrieving only the fonts the current page needs.
- Inlining a declaration is not the same as inlining the font file. Converting a font to base64 and embedding it in CSS increases the amount of data and may delay the discovery of other critical resources.
Preload can start requests earlier, but may compete for bandwidth
Preload lets the browser begin downloading fonts without waiting for stylesheets to finish downloading and being parsed. The trade-off is that it does not first check whether the current page needs the font, so preloading every weight and every font is not advisable.
- Prioritize fonts that would otherwise be discovered late and are important to rendering the page, rather than preloading everything.
- Excessive preloading may download unused fonts and consume bandwidth needed by other critical resources.
- Font preloads must specify crossorigin, even when the fonts are hosted on your own origin.
Third-party fonts add a connection delay
When using a third-party service, the browser must first connect to the provider’s origin to retrieve the relevant resources. This may delay font discovery and downloading. Preconnect establishes connections early to reduce this overhead; it does not download fonts directly.
With Google Fonts, for example, stylesheets and font files may come from different origins. When setting up preconnect for an origin that serves font files using CORS, you need to include crossorigin. Otherwise, the browser may open another connection when downloading the font rather than reuse the connection established in advance. Preconnect and preload address different stages of waiting and should not be treated as the same optimization.
Web font performance and browser font discovery: perspectives from across the web
How can you balance text visibility and visual stability while waiting for fonts to download?
Choose a font-display setting based on your priorities for text visibility and visual stability. Web.dev describes the following options:
swap displays text in a fallback font first, then switches to the web font. If text dimensions differ substantially between the two fonts, the switch may cause a noticeable layout shift.
With fallback, the blocking period—the time when text is temporarily hidden—is extremely short. A fast download may allow the web font to appear directly, while a slower download means text appears in the fallback font first.
optional can avoid the visual shift associated with swap, but if the font finishes downloading too late during the first navigation, the user will not see the web font.
How do font formats and file sizes affect loading?
Large font files may take longer to download and affect First Contentful Paint. If you only need to support modern browsers, WOFF2 is generally suitable. Web.dev notes that it offers up to 30% better compression than WOFF, and smaller files help shorten download times. If the site still needs to support older browsers, however, other formats may be necessary; keeping only WOFF2 is not appropriate in every case.
What loading costs can you reduce by avoiding third-party font services?
Self-hosting web fonts eliminates the need to establish third-party connections. Web.dev notes that this is faster than downloading fonts across origins in most cases, though CDN configuration, HTTP versions, and caching settings still matter. If the design allows system fonts, using them avoids additional requests to download web fonts. System fonts may not look the same as a brand's specified web fonts, so the choice still needs to account for design requirements.
References
- Optimize web fontsweb.dev — Discusses: How can you balance text visibility and visual stability while waiting for fonts to download?; How do font formats and file sizes affect loading?
- Assist the browser with resource hintsweb.dev — Source used in the article above.
- Shopify Site Speed Optimization: 6 Tips to Improve Your Sitewww.semrush.com · 2024-01-29T10:53:00Z — Discusses: What loading costs can you reduce by avoiding third-party font services?



