Both work. On speed, web.dev says the gap between them is less clear cut than you'd think.1 So the better question is how much set-up you want to do yourself, and who looks after the files.
The two options
Self-hosting means the font files sit on your own web hosting, next to your pages. You upload them and write the @font-face rule that points to them.2
A font service stores and serves the fonts for you. You add a line or two of code, and you don't have to write the @font-face code.2 MDN notes that most of these services are subscription-based, with the notable exception of Google Fonts.2 Prices change, so check the service's own page for the cost in your currency before you sign up.
| Self-hosted | Font service | |
|---|---|---|
Who writes the @font-face code |
You | The service2 |
| Where files come from | Your own site | The service's servers |
| Connection to a third party | None | Needed1 |
| File trimming and compression | Up to you1 | Typically done for you1 |
| Cost | Depends on the font's licence2 | Often a subscription, with exceptions2 |
What the speed evidence says
On paper, a self-hosted font should perform better, because there's no third-party connection to set up.1 In practice, web.dev says the difference between the two is less clear cut. It points to a Web Almanac finding that sites using third-party fonts had a faster render than sites using first-party fonts.1
There's a condition. web.dev says that without a content delivery network (CDN) and HTTP/2, it's much less likely that self-hosted fonts will deliver better performance.1 A CDN is a network of servers that hands files out from a location near each visitor. HTTP/2 is a newer way for browsers and servers to talk. Ask your host whether your plan includes both, rather than guessing.
Its suggested test is simple. Serve the font from your own server, then compare the transfer time, including connection set-up, with the third-party font.1 You can run that comparison with the steps on the developer tools page.
The work self-hosting adds
Font services usually trim and compress files for you. If you self-host, web.dev recommends applying some of those same optimisations yourself, such as subsetting and WOFF2 compression.1 Subsetting means keeping only the letters you use. For the format side, see which font file formats a site needs.
Languages matter too. The effort depends partly on which languages your site supports.1
Licences come first
Fonts generally aren't free to use without restrictions. You may have to pay or follow other conditions, such as crediting the maker.2 web.dev adds that you should always check that a font's licence allows subsetting and self-hosting.1
Which suits whom
- Self-hosting suits a site owner who is comfortable uploading files and editing CSS, and whose host offers a CDN and HTTP/2.1
- A font service suits someone who'd rather paste in a line of code and let the provider handle the font files.2
- Either way, keep the number of fonts low. See how many fonts and weights a small site needs.
Before you change anything, note down your current font settings and the code that loads them. Then you can switch back if the result looks wrong. If you're unsure whether your fonts are requested in time, web.dev suggests checking the Timing tab in the Network panel of Chrome DevTools.1
Cited material
- Best practices for fonts, web.dev (Google)
- Web fonts, MDN Web Docs (Mozilla)
