What is the MIME type of .gif files?
The MIME type (media type) for GIF image files with the .gif extension is image/gif. Supports animation with up to 256 colors. For animations, MP4 or animated WebP are usually 5–10× smaller.
Content-Type header
Content-Type: image/gif
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | image/gif gif; |
Apache (.htaccess) | AddType image/gif .gif |
IIS (web.config) | <mimeMap fileExtension=".gif" mimeType="image/gif" /> |
| Node.js / Express | res.type('gif') or res.setHeader('Content-Type', 'image/gif') |
| Amazon S3 | Set Content-Type: image/gif on the object (metadata), or pass --content-type image/gif to aws s3 cp |
Should .gif files be compressed?
No. GIF image files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave image/gif 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 .gif?
image/gif.How do I set the Content-Type for .gif in Nginx?
image/gif gif; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.