# .bz2 MIME Type: application/x-bzip2

> Bzip2-compressed files, usually .tar.bz2 archives.

- MIME type: `application/x-bzip2`
- Extensions: .bz2
- Content-Type header: `application/x-bzip2`
- Compress in transit: no (already compressed)
- File signature: `42 5A 68` (followed by a digit 1–9 giving the block size)

## Good to know

- Bzip2 compresses better than gzip but slowly; most projects have moved on to xz or zstd.

## Server configuration

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

```
application/x-bzip2 bz2;
```

### Apache (.htaccess or server config)

```
AddType application/x-bzip2 .bz2
```

### Express

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

### Python

```
import mimetypes

mimetypes.add_type("application/x-bzip2", ".bz2")
```

### HTML file input

```
<input type="file" accept=".bz2,application/x-bzip2">
```

## FAQ

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

`application/x-bzip2`.

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

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

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

Check its bytes rather than the extension: BZ2 files start with `42 5A 68` (`BZh`) — followed by a digit 1–9 giving the block size. On the command line, `file --mime-type name.bz2` does this for you.

## Related types

- [.gz — application/gzip](https://www.devkult.com/mime/gz.md)
- [.xz — application/x-xz](https://www.devkult.com/mime/xz.md)
- [.zst — application/zstd](https://www.devkult.com/mime/zst.md)
- [.tar — application/x-tar](https://www.devkult.com/mime/tar.md)

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