Optimize Google Fonts
Fonts can become render-blocking work and they can trigger layout shift when the final font loads. If your site uses Google Fonts, the fastest path is usually: reduce what you load, serve it locally, and preload only what the above-the-fold content truly needs.
Decision Order
- Can you use a system font stack? If yes, remove Google Fonts.
- If you need a brand font, self-host a WOFF2 (ideally a variable font).
- Use
font-display: swapand an explicit fallback stack. - Preload only the font file used for above-the-fold text.
Perfmatters Approach
Perfmatters can help you localize Google Fonts and apply swap behavior.
Location:
WP Admin -> Perfmatters -> Assets -> Google Fonts
Common options (names can vary by version):
- Local Google Fonts (download + serve from your site)
- Display Swap (
font-display: swap) - Remove/disable Google Fonts enqueues (when possible)
If your theme/builder also injects fonts, you can end up loading fonts twice. After changing settings, verify in DevTools that Google origins are gone and that only the intended local files load.
Manual Self-Hosting (Alternative)
If you prefer to manage fonts yourself:
- Download fonts (and subset if possible).
- Host as WOFF2.
- Add
@font-faceandfont-display: swap.
Example:
@font-face {
font-family: "Inter";
src: url("/fonts/inter.woff2") format("woff2");
font-display: swap;
font-weight: 100 900;
font-style: normal;
}
body {
font-family: "Inter", system-ui, sans-serif;
}
Preload the font if it is needed above the fold:
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin />
Validation
In Chrome DevTools:
- Network -> filter for "Font".
- Confirm fonts load from your domain/CDN (not
fonts.googleapis.com/fonts.gstatic.com). - Confirm there are no duplicate font downloads.
In PSI/Lighthouse:
- "Ensure text remains visible during webfont load" should be resolved.
- Watch CLS on templates with large headlines/prices (product pages).
Common Mistakes
| Mistake | Why It Hurts | Fix |
|---|---|---|
| Too many families/weights | Extra requests and bytes | Limit families and weights; prefer variable fonts |
| No explicit fallback stack | Text jumps when fonts swap | Use an explicit fallback stack + swap |
| Preloading fonts not used above the fold | Wasted bandwidth | Preload only what affects first render |
| Leaving theme/builder font injection on | Duplicate loads | Disable one source and re-test |