# .epub MIME Type: application/epub+zip

> E-books: a ZIP archive of XHTML, CSS and images.

- MIME type: `application/epub+zip`
- Extensions: .epub
- Content-Type header: `application/epub+zip`
- Compress in transit: no (already compressed)
- File signature: `50 4B 03 04` (the ZIP signature — this format is a ZIP archive inside)

## Good to know

- The first file in the archive must be an uncompressed `mimetype` file containing `application/epub+zip` — that's how readers identify it.

## Server configuration

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

```
application/epub+zip epub;
```

### Apache (.htaccess or server config)

```
AddType application/epub+zip .epub
```

### Express

```
res.set("Content-Type", "application/epub+zip");
```

### Python

```
import mimetypes

mimetypes.add_type("application/epub+zip", ".epub")
```

### HTML file input

```
<input type="file" accept=".epub,application/epub+zip">
```

## FAQ

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

`application/epub+zip`.

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

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

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

Check its bytes rather than the extension: EPUB files start with `50 4B 03 04` (`PK..`) — the ZIP signature — this format is a ZIP archive inside. On the command line, `file --mime-type name.epub` does this for you.

## Related types

- [.pdf — application/pdf](https://www.devkult.com/mime/pdf.md)
- [.zip — application/zip](https://www.devkult.com/mime/zip.md)

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