.epub MIME type
EPUB e-bookdocuments
application/epub+zipE-books: a ZIP archive of XHTML, CSS and images.
| MIME type | application/epub+zip |
|---|---|
| Extensions | .epub |
| Content-Type | application/epub+zip |
| Compress in transit? | No — already compressed |
| File signature | 50 4B 03 04 (PK..) the ZIP signature — this format is a ZIP archive inside |
Good to know
- The first file in the archive must be an uncompressed
mimetypefile containingapplication/epub+zip— that's how readers identify it.
Serve .epub files with the right type
The response header to send:
Content-Type: application/epub+zip
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)
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">
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.epub | grep -i '^content-type:' file --mime-type file.epub
Frequently asked questions
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
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options