What is the EPUB file format?
Files with the .epub extension contain electronic publications - Electronic PUBlication - compressed using the ZIP compression method and stored in an open format based on XML and XHTML. Within the file there is also metadata describing the publication; the format also enables full-text searching.
Such a file may include:
- Book content, with the ability to change the font size and the option to display it with no division into pages (reflowable layout)
- Raster or vector graphics
- Copy-protection via DRM (Digital Rights Management)
- CSS stylesheets controlling typography and layout
- Audio and video media (supported from
.epub3.x onward) - Interactive JavaScript-powered elements (
.epub3.x)
.epub files substituted the previous Open eBook format, introduced by the International Digital Publishing Forum - IDPF - in 2007. Currently, alongside .mobi and .pdf formats, .epub is the most popular standard used for distributing electronic books and other publications on dedicated e-readers, mobile devices, and computers equipped with compatible software.
Internally, an .epub file is a ZIP archive containing .xhtml pages, .css files, images, and an XML-based package document (content.opf) that declares the book's structure and metadata. A special uncompressed entry named mimetype - always the first file in the archive - contains the string application/epub+zip, allowing tools to identify the format reliably. The current standard, EPUB 3.3, became a W3C Recommendation in May 2023, adding improved accessibility, MathML 3 support, and refined scripting rules.
Security & safety
RISK: LOWEPUB is a data format and generally safe. Caveats: EPUB 3 allows JavaScript in content, and reader vulnerabilities (e.g. path-traversal or XSS in older EPUB.js/reader apps) have occasionally allowed malicious books to misbehave - keep reader apps updated and prefer books from reputable sources. Pirated EPUB download sites are the bigger practical risk (bundled adware/fake downloads). DRM-protected files are not dangerous, just restricted.
Format details
in a nutshellPrograms that open EPUB files
Technical details
deep spec| Container format | ZIP archive; a valid .zip file that can be unpacked with any standard ZIP tool |
| MIME type | application/epub+zip |
| Magic bytes | 50 4B 03 04 (ZIP header) at offset 0; uncompressed mimetype entry at offset 30 contains the ASCII string application/epub+zip |
| Content markup | XHTML 1.1 in EPUB 2; HTML5 in EPUB 3 |
| Stylesheet support | CSS 2.1 subset in EPUB 2; CSS Snapshot 2017 subset in EPUB 3 |
| Package document | `content.opf` - XML file declaring the book's manifest, spine order, and Dublin Core metadata |
| Navigation document | `toc.ncx` in EPUB 2; `nav.xhtml` in EPUB 3 |
| Reflowable layout | Text and layout adapt dynamically to the reader's screen size, font size, and user preferences |
| Fixed layout | Optional fixed-layout (FXL) mode for comics, children's books, and graphic novels (EPUB 3) |
| DRM support | Optional; AES-128 encryption; common schemes include Adobe ADEPT and Apple FairPlay |
| Audio and video | HTML5 `<audio>` and `<video>` elements supported within EPUB 3 spine documents |
| Scripting | JavaScript supported at spine-level and container-level in EPUB 3; absent in EPUB 2 |
| Accessibility | EPUB Accessibility 1.1 specification; ARIA landmark roles; WCAG 2 compliance metadata in OPF |
| MathML support | MathML 3 supported natively in EPUB 3.3 |
| Metadata standard | Dublin Core elements (dc:title, dc:creator, dc:language) required in the OPF package document |
| Standard body | W3C (IDPF merged into W3C in February 2017); EPUB 3.3 became a W3C Recommendation in May 2023 |
| Released | 2007 (EPUB 2.0, IDPF); current version EPUB 3.3, W3C Recommendation May 2023 |
| Open standard | Yes · royalty-free |
| Specification | www.w3.org |
EPUB conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about EPUB files.