Upload WOFF2. For most small sites that's the whole answer, and it's what both MDN and web.dev point to.12
What the four names mean
TTF is short for TrueType and OTF for OpenType. WOFF is the Web Open Font Format, and WOFF2 is version 2 of it. MDN notes that WOFF2 supports the entirety of the TrueType and OpenType specifications, including variable fonts.1
| Format | Where it fits | What the sources say |
|---|---|---|
| WOFF2 | The usual choice for a website | Compresses fonts more efficiently than older formats like WOFF or OpenType3 |
| WOFF | A site that must reach older browsers | You may also need it if you support older browsers1 |
| TTF | Often what a font download contains | Listed by MDN as TrueType, with the MIME type font/ttf3 |
| OTF | Often what a font download contains | Compressed less efficiently than WOFF23 |
Why WOFF2 wins on size
WOFF2 uses a compression method called Brotli. web.dev says that makes WOFF2 compress 30% better than WOFF, so there's less data to download.2 Support is no longer the worry it once was. MDN says all modern browsers support WOFF2.1 A web.dev article goes further and quotes a Web Almanac author saying WOFF2 is now supported everywhere, and to use only WOFF2.2
Do you still need the older ones?
Two kinds of site, two answers.
Most small business sites. Use WOFF2 only. The same quoted advice says this simplifies your CSS and prevents accidental double or incorrect font downloads.2 MDN agrees that it's a good idea to provide as few web font files as possible.1
A site that must reach very old browsers. MDN says that in this case you may also need to provide WOFF.1 The other choice web.dev offers is not serving a web font to those browsers at all. Visitors on those browsers would see your fallback fonts instead.2
If you do list more than one file, order matters. Browsers try the sources in the order you list them.3 Put WOFF2 first.
Getting a WOFF2 file
MDN's own walkthrough generates the web files with an online generator. It tells you to make sure only the WOFF2 box is ticked and to untick WOFF.1
Before you convert or upload anything, read the font's licence. MDN says fonts generally aren't free to use without restrictions.1 web.dev adds a reminder to check that the licence allows subsetting and self-hosting, which means trimming the file and serving it from your own site.2 The licence text itself is the place to check.
A short checklist for your own site:
- Check the font's licence covers use on a website.
- Get or make a WOFF2 version.1
- Link only that file in your
@font-facerule. - Add WOFF only if you know you need to reach very old browsers.
After that, the next question is how the browser behaves while the file is still downloading. That's font-display. To confirm which file your visitors really receive, open the Network panel.
Cited material
- Web fonts, MDN Web Docs (Mozilla)
- Best practices for fonts, web.dev (Google)
- @font-face, MDN Web Docs (Mozilla)