What is the MIME type of .epub files?
The MIME type (media type) for EPUB e-book files with the .epub extension is application/epub+zip. A ZIP archive of XHTML chapters.
Content-Type header
Content-Type: application/epub+zip
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | application/epub+zip epub; |
Apache (.htaccess) | AddType application/epub+zip .epub |
IIS (web.config) | <mimeMap fileExtension=".epub" mimeType="application/epub+zip" /> |
| Node.js / Express | res.type('epub') or res.setHeader('Content-Type', 'application/epub+zip') |
| Amazon S3 | Set Content-Type: application/epub+zip on the object (metadata), or pass --content-type application/epub+zip to aws s3 cp |
Should .epub files be compressed?
No. EPUB e-book files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave application/epub+zip out of your compression configuration.
Why the MIME type matters
Browsers decide what to do with a response — render, run, play or download — from the Content-Type header, not the file extension. With X-Content-Type-Options: nosniff, a wrong type causes stylesheets and scripts to be blocked outright. For uploads, never trust the type sent by the client; check the file’s content (its magic bytes) on the server.
Frequently asked questions
What is the MIME type for .epub?
application/epub+zip.How do I set the Content-Type for .epub in Nginx?
application/epub+zip epub; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.