Performance Auditor — checks that web fonts show text immediately, ship in the smallest format, come from the page’s own host and stay small.
Performance
Fonts are on the critical path of every first visit. The wrong setup hides text, opens extra connections and downloads hundreds of kilobytes nobody reads.
Per family and per file
Findings name the font family, the stylesheet that declares it and the file that is too large, so you know exactly what to change.
@font-face rules a page declares and its font preload links, then checks them against the checklist of the Browser Diet article Web Fonts Without the Flash: WOFF2 only, self-hosted, at most two families (variable when possible), font-display: swap or optional, metric-compatible fallbacks, one preloaded font with crossorigin, and subsetted files.
How it works
- Fetch the page — requests the audited URL (redirects followed). A network failure or non-2xx status produces an
ERRORresponse and nothing else is evaluated. - Collect the CSS — reads every inline
<style>block andstyleattribute, downloads every linked stylesheet (including therel="preload" as="style"pattern), and follows@importone level deep. Up to 30 stylesheets, 10 at a time, 10-second timeout each. - Parse the font rules — extracts every
@font-facerule: family,font-display, the sources of the lastsrcdescriptor with their formats, weight, style,unicode-rangeand metric overrides (size-adjust,ascent-override,descent-override,line-gap-override). Font preload links (<link rel="preload" as="font">) are collected from the HTML. - Keep what the browser downloads — a rule is judged only when its family is referenced by CSS outside
@font-face(or its file is preloaded), its first supported source is a downloadable file, and itsunicode-rangecovers at least one character of the page text. Declared but unreferenced families are listed in the check data asunusedFamiliesand are not judged. - Measure the font files — asks for the size of each downloaded font file with
HEAD(falling back toGET), up to 20 files. - Aggregate — any
FAILrule makes the auditFAIL; otherwise anyWARNINGrule makes itWARNING; when every rule passes the audit isSUCCESS.
font-display, family-count and fallback-metric rules, because hiding icon glyphs until the font arrives is the correct behaviour. They are still checked for WOFF2, hosting and file size.
What it audits
Every row maps to onecheckRule* method and one CheckCode. CheckCode suffixes use status ranges: 200 success, 300–399 warning, 400–499 fail, 500–599 error. Rules 400–402 and 302 run once per font family, 300 once per font host, 303 once per preload link, 306 once per font file and 307–308 once per stylesheet.
Every message quotes what was observed, for example:
Font family "Inter" has 2 @font-face rule(s) without font-display in /css/site.css, so its text stays invisible while the font downloads. or Font file /fonts/inter.woff2 ("Inter") weighs 313 KB, above the 100 KB budget.
Output documentation
Risks and considerations
Invisible text loses readers
- Without
font-display, browsers hide text for up to three seconds while a font downloads. On a slow phone connection that is three seconds of a blank page. swapshows the fallback font at once and swaps when the web font arrives.optionaluses the web font only when it is already cached, which is the calmest choice for body text.
Every extra file and host is paid on the first visit
- WOFF2 is the smallest font format and all current browsers support it; older formats are larger for no benefit.
- Fonts on another host need a new DNS lookup, connection and TLS handshake, because font requests never reuse the connection that fetched the stylesheet.
- A font preload without
crossoriginis thrown away and the file is downloaded twice. Several preloads delay the stylesheets and images behind them. - Subsetting to the characters a site uses typically cuts a font file by 60–80%. One variable font file can replace four or more static weight files.
Layout shift when fonts swap
- A fallback font with different metrics makes lines reflow when the web font arrives. A fallback
@font-facetuned withsize-adjust,ascent-overrideanddescent-overridekeeps the text in place.
What this auditor does not check
- Fonts declared by JavaScript. Only CSS present in the HTML, in linked stylesheets and one level of
@importis read. Styles injected at runtime are not seen. - Whether a CSS rule matches an element. A family counts as used when any CSS rule references it, even if that rule matches nothing on the page. Themes that define many font presets can therefore report more families than a visitor downloads.
- Proof of subsetting. File size is the only signal: a file over 100 KB is reported, but the glyphs inside it are not inspected. A variable font with several axes can exceed the budget even when subsetted.
- Legacy fallbacks after WOFF2. A
srcthat lists WOFF2 first and older formats after it passes; the extra entries cost nothing in current browsers. - More than 20 font files or 30 stylesheets. Larger pages are sampled in document order.
- Stylesheets and fonts on other hosts are requested without the page’s Basic Auth credentials. Caching of font files is covered by the Cache Auditor, and compression by the Content Encoding Auditor.