# .gif MIME Type: image/gif

> Animated and 256-colour images.

- MIME type: `image/gif`
- Extensions: .gif
- Content-Type header: `image/gif`
- Compress in transit: no (already compressed)
- File signature: `47 49 46 38 39 61` (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.

## Server configuration

### 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">
```

## FAQ

### 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

- [.png — image/png](https://www.devkult.com/mime/png.md)
- [.webp — image/webp](https://www.devkult.com/mime/webp.md)
- [.mp4 — video/mp4](https://www.devkult.com/mime/mp4.md)

Open the interactive page: https://www.devkult.com/mime/gif