Web Font Loading
How custom typefaces are fetched and shown, and why the cost is easy to misattribute.
Web font loading is the process by which a browser fetches a typeface referenced by a style rule and applies it to text. It is worth understanding precisely because font bytes are large and the cost is easy to attribute to the wrong thing.
The controlling fact is that a font file is only fetched when some rendered element's computed font family actually matches the declared face. Declaring a face costs nothing but the rule itself. Binding a class or a custom property that names it costs nothing. Only a match causes a download. This means a claim like "visitors are downloading a font they never see" is frequently false, and the way to know is to measure requests in a real browser rather than reason from the stylesheet.
The visible behavior while a font is pending is controlled by font-display. The choices trade a flash of unstyled text against a flash of invisible text; the latter is worse for perceived performance and for Core Web Vitals, since a layout shift lands when the real face arrives.
Two practical notes. Build tools that self-host fonts commonly hash the family name, so any test asserting on a literal family name will fail — assert on the fallback stack instead. And preloading the specific files needed for first paint removes a full round trip from the Critical Rendering Path.
See also8
Typographic Scale
A constrained set of type sizes and their paired line heights and spacing.
Design & Interface17 connections
Performance Budget
A committed numeric ceiling on a page's cost, enforced automatically.
Web Platform26 connections
Code Splitting
Dividing an application bundle so a page downloads only the code it needs.
Web Platform17 connections
Server-Side Rendering
Producing a page's HTML on the server so the first response is already content.
Web Platform23 connections
Module Graph
The directed graph of imports that decides what code ends up where.
Web Platform22 connections
Ground Truth
The measurement that arbitrates, as opposed to the artifact that merely reports.
Method99 connections
Silent Failure
A failure that produces no signal, so the absence of an error reads as success.
Method73 connections
Layout Shift
Visible content jumping position after it first appears, usually because something loaded late without reserved space, measured by browsers as Cumulative Layout Shift.
Web Platform12 connections
Linked from7
- Core Web VitalsWeb Platform
Google's small set of user-centered performance metrics: loading, interactivity, and visual stability.
- Critical Rendering PathWeb Platform
The sequence of steps between receiving HTML and painting pixels, and everything that blocks it.
- Layout ShiftWeb Platform
Visible content jumping position after it first appears, usually because something loaded late without reserved space, measured by browsers as Cumulative Layout Shift.
- Performance BudgetWeb Platform
A committed numeric ceiling on a page's cost, enforced automatically.
- Preload and PrefetchWeb Platform
Two resource hints with opposite priorities — preload for what this page needs now, prefetch for what the next page might need.
- Typographic ScaleDesign & Interface
A constrained set of type sizes and their paired line heights and spacing.
- Variable FontsDesign & Interface
A single font file that encodes a continuous design space, letting weight, width, and other axes be set to any value at runtime.