# .gz MIME Type: application/gzip

> A gzip-compressed file, registered by RFC 6713.

- MIME type: `application/gzip`
- Extensions: .gz, .gzip
- Also seen as: `application/x-gzip`
- Content-Type header: `application/gzip`
- Compress in transit: no (already compressed)
- File signature: `1F 8B`

## Good to know

- Serving a `.gz` download as `application/gzip` is different from `Content-Encoding: gzip`, which tells the browser to decompress a response transparently. Mixing them up makes browsers save already-decompressed files with a `.gz` name, or the reverse.
- `.tar.gz` and `.tgz` files are tar archives compressed with gzip and use this type.

## Server configuration

### nginx (inside the types block in mime.types)

```
application/gzip gz gzip;
```

### Apache (.htaccess or server config)

```
AddType application/gzip .gz .gzip
```

### Express

```
res.set("Content-Type", "application/gzip");
```

### Python

```
import mimetypes

mimetypes.add_type("application/gzip", ".gz")
mimetypes.add_type("application/gzip", ".gzip")
```

### HTML file input

```
<input type="file" accept=".gz,.gzip,application/gzip">
```

## FAQ

### What is the MIME type for .gz files?

`application/gzip`. You may also see `application/x-gzip`, but `application/gzip` is the one to send. The same type covers .gzip.

### What Content-Type header should a .gz file be served with?

`Content-Type: application/gzip`. It's already compressed, so servers shouldn't gzip it.

### How can I tell if a file is really a .gz?

Check its bytes rather than the extension: GZ files start with `1F 8B`. On the command line, `file --mime-type name.gz` does this for you.

## Related types

- [.tar — application/x-tar](https://www.devkult.com/mime/tar.md)
- [.zip — application/zip](https://www.devkult.com/mime/zip.md)
- [.7z — application/x-7z-compressed](https://www.devkult.com/mime/7z.md)

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