font-display: optional Strategy
You'll learn when to prioritize performance by making custom fonts truly optional—only using them if they're already cached.
What Makes optional Special
The font-display: optional strategy takes the most aggressive performance stance of all font-display values. It tells the browser: "Use this custom font only if it's already downloaded (cached from a previous visit). Otherwise, stick with the system font—permanently."
Unlike swap (which waits indefinitely) or fallback (which gives a short grace period), optional gives the font approximately 100ms to load. If it doesn't arrive in that tiny window, the browser uses the fallback font for the entire page session. Even if the custom font finishes downloading seconds later, it won't be applied. The browser may still download it quietly in the background for future visits.
When to Use Optional
This strategy is ideal for performance-critical sites where:
- Speed trumps branding: You value instant text rendering over custom typography
- Repeat visitors benefit: First-time visitors see system fonts; returning visitors get the custom font (because it's cached)
- No layout shift tolerance: You want zero FOUT (Flash of Unstyled Text) on repeat visits
@font-face {
font-family: 'CustomFont';
src: url('font.woff2') format('woff2');
font-display: optional;
}
Think of it like a "nice-to-have" amenity: if the custom font is immediately available (cached), great! If not, the site works perfectly fine without it—no waiting, no swapping, no visual disruption.
Key Takeaway: Use font-display: optional when custom fonts are enhancement-only and you refuse to let slow font loading degrade the user experience—first impressions use system fonts, returning visitors get the upgrade.