.gif MIME type
GIF imageimages
image/gifAnimated and 256-colour images.
| MIME type | image/gif |
|---|---|
| Extensions | .gif |
| Content-Type | image/gif |
| Compress in transit? | No — already compressed |
| File signature | 47 49 46 38 39 61 (GIF89a) or GIF87a for the older version |
Good to know
- For animation, a muted looping
<video>in MP4 or WebM is often a tenth of the size. - Each frame is limited to a 256-colour palette.
Serve .gif files with the right type
The response header to send:
Content-Type: image/gif
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)
image/gif gif;
Apache (.htaccess or server config)
AddType image/gif .gif
Express
res.set("Content-Type", "image/gif");Python
import mimetypes
mimetypes.add_type("image/gif", ".gif")HTML file input
<input type="file" accept=".gif,image/gif">
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.gif | grep -i '^content-type:' file --mime-type file.gif
Frequently asked questions
What is the MIME type for .gif files?
image/gif.
What Content-Type header should a .gif file be served with?
Content-Type: image/gif. It's already compressed, so servers shouldn't gzip it.
How can I tell if a file is really a .gif?
Check its bytes rather than the extension: GIF files start with 47 49 46 38 39 61 (GIF89a) — or GIF87a for the older version. On the command line, file --mime-type name.gif does this for you.
Related types
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options