Iâ€™ve used Google Fonts in prototypes and in 10M+ MAU products. Itâ€™s incredibly easy to get started with and provides an amazing font discovery. Thatâ€™s also why itâ€™s currently still used on over 42M websites!
This convenience has its price: Performance. Many havealreadypointedout the cost of multiple requests. If you want the remaining speed boost, then youâ€™re best off downloading your used Google Fonts and self-host them.
This is nothing new. In fact itâ€™s been advocated already since years. Even Google themselves advised others to self-host fonts in their Google I/O â€˜18 talk about web performance.
Self-hosting fonts vs Google Fonts
By nature Google Fonts, even with all its font and CSS optimisations, canâ€™t be faster than self-hosted fonts.
Sia wrote a great post where she compared the performance between Google Fonts and self-hosted fonts without the impact of a CDN.
Optimised Google Fonts loading with preconnect
Optimised self-hosting fonts with preload
The old performance argument
So if the bottom-line performance is in self-hosting fontsâ€™ favour: What was the argument that convinced us developers that Google Fonts is at least as performing as the self-host approach?
Google Fonts was designed to be distributed on a global CDN and reap the caching benefits from it. Users request fonts via said CDN. Chances are that they have downloaded the font resources at an earlier point already from a different site.
â€œ[â€¦] Our cross-site caching is designed so that you only need to load a font once, with any website, and weâ€™ll use that same cached font on any other website that uses Google Fonts.â€
Invalidating the old performance argument
Since Chrome v86, released October 2020, cross-site resources like fonts canâ€™t be shared on the same CDN anymore. This is due to the partitioned browser cache (Safari has had this for years already).
In this Google post they explain what the partitioned browser cache is. It got only introduced to prevent a possible cross-site tracking mechanism.
Cache partitioning in other browsers
Safari really cares about privacy. It circumvented this very cross-site tracking attack since years already. Then finally comes Chrome. Other browsers that are based off Chromium, still need to signal or implement the feature.
- Chrome: since v86 (October 2020)
- Safari: since 2013
- Firefox: planning to implement
- Edge: most likely soon
- Opera: most likely soon
- Brave: most likely soon
- Vivaldi: most likely soon
Google Fonts resources will be redownloaded for every website, regardless it being cached on the CDN. Self-host your fonts for better performance. The old performance argument is not valid anymore.
Thanks for checking this post out!