What is the MIME type of .woff2 files?
The MIME type (media type) for Web font (WOFF2) files with the .woff2 extension is font/woff2. The preferred web font format — Brotli-compressed internally, so do not compress it again. Fonts loaded cross-origin need CORS headers (Access-Control-Allow-Origin).
Content-Type header
Content-Type: font/woff2
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | font/woff2 woff2; |
Apache (.htaccess) | AddType font/woff2 .woff2 |
IIS (web.config) | <mimeMap fileExtension=".woff2" mimeType="font/woff2" /> |
| Node.js / Express | res.type('woff2') or res.setHeader('Content-Type', 'font/woff2') |
| Amazon S3 | Set Content-Type: font/woff2 on the object (metadata), or pass --content-type font/woff2 to aws s3 cp |
Should .woff2 files be compressed?
No. Web font (WOFF2) files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave font/woff2 out of your compression configuration.
Why the MIME type matters
Browsers decide what to do with a response — render, run, play or download — from the Content-Type header, not the file extension. With X-Content-Type-Options: nosniff, a wrong type causes stylesheets and scripts to be blocked outright. For uploads, never trust the type sent by the client; check the file’s content (its magic bytes) on the server.
Frequently asked questions
What is the MIME type for .woff2?
font/woff2.How do I set the Content-Type for .woff2 in Nginx?
font/woff2 woff2; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.