WOFF2

What is a WOFF2 file?

The current web font format, around 30% smaller than WOFF.

What WOFF2 is

WOFF2 is a binary format, meaningful only to a program that knows it. It is used for the web.

The extension is .woff2, and the full name is Web Open Font Format 2. Both matter less than what the file can hold, which is what the rest of this page is about.

Where WOFF2 came from

W3C published it in 2018. The specification is WOFF 2.0.

Age is worth knowing here for one practical reason: the older a format is, the more programs have had time to learn it.

The specification is public

It is published in full, so anyone can implement it from the document rather than by inspection, which is why it turns up in so many programs and why files written twenty years ago still open. A published specification is not the same thing as a royalty-free one: where a format wraps a codec, the patent licensing is a separate question the standard does not settle.

Nothing is thrown away

WOFF2 stores its content exactly. Saving it again changes nothing, so it can be opened, edited and re-saved as often as you like without accumulating damage — which is what makes it a working format rather than a delivery one.

What opens WOFF2

fonttools and FontForge read it, and so do most programs of the same kind.

If a file will not open, the format is rarely the problem — it is more often that the program predates it. Converting to something older is the reliable way past that, and it is what the rest of this site is for.

Opening it in a browser

Every current browser reads it.

That makes it a safe thing to put on a page or attach to a message without wondering what the other end has installed.

It is a delivery format

WOFF2 is meant to be handed over rather than worked in. Editing one is possible and rarely pleasant; the sane approach is to change the source and export again.

A transport format, not a new kind of font

WOFF2 is not a font format in the way TrueType and OpenType are. It is a wrapper: the same font tables, compressed with Brotli and tuned specifically for the way font data is laid out, plus a small amount of metadata. Unwrap a WOFF2 and what comes out is the TTF or OTF that went in.

That is why it is the only sensible choice for a website and useless on the desktop. It exists to make the file smaller in transit, typically by thirty to fifty per cent against the original, and operating systems do not install it because there is nothing to install that the original did not already have.

Declaring it in CSS

A font arrives on a page through an @font-face rule: a family name, the file, and the weight and style that file represents. The name is arbitrary and local to your stylesheet — nothing has to match what the foundry called it — and the weight and style declarations are what let the browser pick the right file when text is set in bold or italic.

The most common mistake is declaring one file for a family and then using bold in the design. The browser will not refuse; it will synthesise a bold by smearing the regular weight, and the result is visibly worse than the real bold sitting unused in the same folder. One @font-face rule per file, with honest weight and style values, is the whole discipline.

Subsetting matters more than the format

A typical retail font covers Latin, Latin Extended, Cyrillic, Greek, currency symbols and several hundred glyphs nobody on your site will ever type. All of it is downloaded by every visitor.

Subsetting strips it to the characters actually needed, and the saving usually dwarfs what compression achieves. A 300 KB desktop font subset to basic Latin and converted to WOFF2 routinely lands around 25 KB. Do both, in that order, and be careful with the subsetter: told to keep only the used characters, it will happily discard the ligature and alternate tables as well, and the CSS switching them on then does nothing.

The flash of invisible text

A browser that has been told to use a font it has not downloaded yet has to decide what to do with the text in the meantime. By default it waits — up to three seconds in most browsers — and shows nothing. That is the flash of invisible text, and it is the single most common reason a site with custom type feels slow.

The fix is one line: font-display: swap in the @font-face rule. The text is drawn immediately in a fallback and reflows to the real font when it arrives. The reflow is visible and it is far less bad than a blank page. font-display: optional goes further — if the font is not ready almost immediately it is not used at all for that visit, which removes the reflow entirely at the cost of some visitors never seeing the typeface.

Self-hosting rather than linking a font service

Loading fonts from a third-party service used to be faster because visitors arrived with the file already cached from another site. That has not been true since browsers partitioned their caches per site — every visitor now downloads it again, and the request costs an extra connection to another server before the font even starts.

Self-hosting is now the faster option in nearly every case, and it also removes a third party from the request path, which matters both for privacy law and for the site continuing to work when somebody else’s service does not. Preloading the one or two fonts that appear above the fold is the remaining trick worth applying.

Do you still need a WOFF fallback?

No. WOFF2 has been supported by every current browser for years, including Safari and the mobile browsers, and the fallback stack that once accompanied every @font-face rule — WOFF, TTF, EOT, SVG — is now archaeology.

Declaring only WOFF2 is the current advice. Anything that cannot read it is old enough that it will fall back to a system font, which is a perfectly acceptable outcome and considerably better than serving five copies of the same typeface to everybody so that a browser nobody uses gets its preferred one.

The licence question, again

Converting a desktop font to WOFF2 takes seconds and is frequently a breach of the licence that came with it. Desktop licences cover installing the font on machines and making things with it; web use is normally a separate licence, sold separately, often priced by monthly page views.

Open licences are the exception worth knowing: fonts issued under the SIL Open Font License may be converted, self-hosted and subset freely, subject to not being sold on their own and not reusing reserved names. That covers most of what is on the free font sites, and it is why so much of the web is set in a handful of open families.

The facts, in one place

Identifiers and provenance for the WOFF2 format.
Extension.woff2
Media typefont/woff2
Published byW3C
First published2018
SpecificationWOFF 2.0

WOFF2 files: common questions

How do I install a WOFF2 font on my computer?

You do not — it is a web transport format and operating systems do not install it. Convert it to TTF or OTF and install that instead. Nothing is lost in the conversion; WOFF2 is a compressed wrapper around exactly those tables.

What is the difference between WOFF and WOFF2?

The compression. WOFF uses zlib, WOFF2 uses Brotli tuned for font data and comes out around 30 per cent smaller. They are otherwise the same idea, and WOFF2 is supported by every current browser, so there is no longer a reason to serve both.

Do I still need WOFF, TTF and EOT fallbacks?

No. That stack is archaeology. Every current browser reads WOFF2, and anything that does not is old enough to fall back to a system font gracefully. Declaring WOFF2 alone is the current advice.

Why does my text flash or appear late?

The browser is waiting for the font before drawing anything — the flash of invisible text. Add font-display: swap to the @font-face rule and the text appears immediately in a fallback, then reflows when the font arrives.

Is it faster to use a font service or host the font myself?

Self-hosting, in nearly every case. Browsers now partition their caches per site, so the shared-cache advantage that once justified a third-party service is gone, and the extra connection costs time before the font is even requested.

Can I convert any font to WOFF2 and use it on my site?

Technically always, legally often not. Desktop licences typically exclude web use, which is sold separately. Fonts under the SIL Open Font License may be converted, subset and self-hosted freely, subject to not being sold alone and not reusing reserved names.