Why Font Optimization Matters
Web fonts can significantly impact performance. Unoptimized fonts cause Flash of Invisible Text (FOIT) or Flash of Unstyled Text (FOUT), hurting user experience and Core Web Vitals.
Font Loading Strategies
font-display Property
Control how fonts load and display:
`` @font-face {
font-family: 'CustomFont';
src: url('font.woff2') format('woff2');
font-display: swap;
}
css
`
Values:
: Show fallback immediately, swap when loaded: Use if cached, skip if not: Brief block, then fallback: Block rendering until loadedPreload Critical Fonts
Load important fonts early:
`html
as="font" type="font/woff2" crossorigin>
``
Optimization Techniques
Subset Fonts
Only include characters you need:
Use Variable Fonts
One file for multiple weights:
Self-Host vs CDN
Best Practices
Audit your font loading with our free performance tool.