What is MIME type "application/epub+zip"?
A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.
application/epub+zip is the MIME type for digital books in the EPUB format.It marks a file as an electronic publication packaged in a compressed ZIP archive.
The archive holds text, images, and stylesheets that combine to form reflowable and interactive content.
- Digital Publishing: Used to distribute and display e-books.
- Portable Content: Adapts smoothly to screens on tablets, smartphones, and dedicated e-readers.
- Interactive Documents: Supports multimedia, hyperlinks, and advanced formatting.
For more details on the standard, visit the EPUB 3.3 specification.
Associated file extensions
Usage Examples
HTTP Header
When serving content with this MIME type, set the Content-Type header:
Content-Type: application/epub+zip
HTML
In HTML, you can specify the MIME type in various elements:
<a href="file.dat" type="application/epub+zip">Download file</a>
Server-side (Node.js)
Setting the Content-Type header in Node.js:
const http = require('http');
http.createServer((req, res) => {
res.setHeader('Content-Type', 'application/epub+zip');
res.end('Content here');
}).listen(3000);
Associated file extensions
FAQs
How do I configure Apache or Nginx to serve EPUB files?
To ensure browsers and e-readers handle the file correctly, you must set the Content-Type header. In Apache, add the line AddType application/epub+zip .epub to your .htaccess or config file. For Nginx, include application/epub+zip epub; within the types block in your nginx.conf or mime.types file.
Why does the MIME type end with +zip?
The +zip suffix indicates that the EPUB format is based on a structured ZIP archive. An .epub file is actually a compressed container holding HTML, CSS, images, and XML metadata; you can verify this by renaming a file from .epub to .zip and opening it to view the internal structure.
Do web browsers support application/epub+zip natively?
Most modern browsers (Chrome, Firefox, Safari) do not render application/epub+zip natively and will usually download the file instead. To view these files directly in a browser, users typically require a dedicated extension (like Readium) or a web-based JavaScript reader library embedded in the page.
What happens if an EPUB is served as application/zip?
If a server sends the generic application/zip MIME type, the browser or client will treat the file as a standard compressed folder rather than a digital book. This prevents e-book reader applications from automatically launching and forces the user to manually unzip or import the file.
Are there security risks associated with this MIME type?
Yes, because the EPUB 3 standard supports HTML5 and JavaScript, it is possible for files to contain malicious scripts. While most dedicated e-readers sandbox this content, you should be cautious when opening files from untrusted sources, just as you would with standard web pages.
What is the correct file extension for application/epub+zip?
The standard extension is .epub. While the underlying format is a ZIP archive, using the .zip extension is incorrect for distribution because it obscures the file's purpose as a digital publication and breaks association with e-reader software.
General FAQ
What is a MIME type?
A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.
MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.
MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.
How do I find the MIME type for a file?
You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.
Why are multiple MIME types listed for one extension?
Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.