What is the MIME type of .avif files?
The MIME type (media type) for AVIF image files with the .avif extension is image/avif. AV1-based image format, typically smaller than WebP. Some older servers do not know the extension and send application/octet-stream — add the type explicitly.
Content-Type header
Content-Type: image/avif
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | image/avif avif; |
Apache (.htaccess) | AddType image/avif .avif |
IIS (web.config) | <mimeMap fileExtension=".avif" mimeType="image/avif" /> |
| Node.js / Express | res.type('avif') or res.setHeader('Content-Type', 'image/avif') |
| Amazon S3 | Set Content-Type: image/avif on the object (metadata), or pass --content-type image/avif to aws s3 cp |
Should .avif files be compressed?
No. AVIF image files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave image/avif 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 .avif?
image/avif.How do I set the Content-Type for .avif in Nginx?
image/avif avif; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.