.woff2 MIME type
WOFF2 fontfonts
font/woff2The web font format to use today: Brotli-compressed, supported by every current browser.
| MIME type | font/woff2 |
|---|---|
| Extensions | .woff2 |
| Content-Type | font/woff2 |
| Compress in transit? | No — already compressed |
| File signature | 77 4F 46 32 (wOF2) |
Good to know
- Already compressed — don't gzip it again.
- Fonts loaded cross-origin need
Access-Control-Allow-Origin;@font-facerequests are CORS requests. - Fingerprinted font files can be cached for a year with
Cache-Control: public, max-age=31536000, immutable.
Serve .woff2 files with the right type
The response header to send:
Content-Type: font/woff2
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
nginx (inside the types block in mime.types)
font/woff2 woff2;
Apache (.htaccess or server config)
AddType font/woff2 .woff2
Express
res.set("Content-Type", "font/woff2");Python
import mimetypes
mimetypes.add_type("font/woff2", ".woff2")HTML file input
<input type="file" accept=".woff2,font/woff2">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.woff2 | grep -i '^content-type:' file --mime-type file.woff2
Frequently asked questions
What is the MIME type for .woff2 files?
font/woff2.
What Content-Type header should a .woff2 file be served with?
Content-Type: font/woff2. It's already compressed, so servers shouldn't gzip it.
How can I tell if a file is really a .woff2?
Check its bytes rather than the extension: WOFF2 files start with 77 4F 46 32 (wOF2). On the command line, file --mime-type name.woff2 does this for you.
Related types
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options