What Is EPUB?
EPUB — Electronic Publication — is the open standard for digital books published by the W3C EPUB Working Group (formerly the IDPF). First released in 2007 as EPUB 2.0.1, it replaced the older Open eBook (OEB) format. The current version is EPUB 3.3 (2023), which aligns the format with modern web technologies: HTML5, CSS3, SVG, JavaScript, and MathML.
EPUB is used by virtually every digital publishing ecosystem except Amazon's proprietary AZW/MOBI/KFX formats. Major devices and platforms include: Apple Books, Kobo, Barnes & Noble Nook, Google Play Books, Calibre, FBReader, Adobe Digital Editions, and most open-source e-readers.
Physical Structure: EPUB is a ZIP
Every EPUB file is a renamed ZIP archive. Unzipping any .epub file reveals:
mimetype ← must be first file, uncompressed
META-INF/
container.xml ← points to the OPF file
encryption.xml (optional)
signatures.xml (optional)
OEBPS/ (or any name)
content.opf ← package document (spine, manifest, metadata)
toc.ncx ← legacy EPUB 2 navigation
nav.xhtml ← EPUB 3 navigation document
Text/
chapter01.xhtml
chapter02.xhtml
...
Images/
cover.jpg
figure01.png
...
Styles/
stylesheet.css
Fonts/
MyFont.otf
The mimetype file contains exactly application/epub+zip — no newline, no BOM — and must be the first entry in the ZIP, stored uncompressed. This allows MIME-type sniffing without full decompression.
Package Document (OPF)
The OPF (Open Packaging Format) file is the manifest of the publication:
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0"
xml:lang="en" unique-identifier="bookid">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier id="bookid">urn:isbn:9780000000000</dc:identifier>
<dc:title>The Complete EPUB Guide</dc:title>
<dc:creator id="author">Jane Doe</dc:creator>
<dc:language>en</dc:language>
<dc:publisher>Tech Books Inc.</dc:publisher>
<dc:date>2024-01-15</dc:date>
<meta property="dcterms:modified">2024-01-15T10:00:00Z</meta>
<meta name="cover" content="cover-image"/>
</metadata>
<manifest>
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml"
properties="nav"/>
<item id="cover-image" href="Images/cover.jpg" media-type="image/jpeg"
properties="cover-image"/>
<item id="ch01" href="Text/chapter01.xhtml"
media-type="application/xhtml+xml"/>
<item id="ch02" href="Text/chapter02.xhtml"
media-type="application/xhtml+xml"/>
<item id="css" href="Styles/stylesheet.css" media-type="text/css"/>
</manifest>
<spine>
<itemref idref="ch01"/>
<itemref idref="ch02"/>
</spine>
</package>
Key components:
<metadata>: Dublin Core elements (title, creator, language, identifier) plus EPUB-specific meta properties.<manifest>: lists every file in the publication with its media type and optional properties.<spine>: defines the reading order — which documents the e-reader presents in sequence.<guide>(EPUB 2): legacy navigation landmarks (now replaced by<landmarks>in nav.xhtml).
Navigation Document (nav.xhtml)
EPUB 3's navigation document replaces the EPUB 2 NCX file:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:epub="http://www.idpf.org/2007/ops">
<head><title>Table of Contents</title></head>
<body>
<nav epub:type="toc" id="toc">
<h1>Contents</h1>
<ol>
<li><a href="Text/chapter01.xhtml">Chapter 1: Introduction</a></li>
<li><a href="Text/chapter02.xhtml#section2">Chapter 2: Deep Dive</a>
<ol>
<li><a href="Text/chapter02.xhtml#sub1">2.1 Sub-topic</a></li>
</ol>
</li>
</ol>
</nav>
<nav epub:type="landmarks">
<ol>
<li><a epub:type="toc" href="nav.xhtml#toc">Table of Contents</a></li>
<li><a epub:type="bodymatter" href="Text/chapter01.xhtml">Start</a></li>
</ol>
</nav>
</body>
</html>
EPUB 2 vs. EPUB 3
| Feature | EPUB 2.0.1 | EPUB 3.3 |
|---|---|---|
| Content documents | XHTML 1.1 | HTML5 / XHTML5 |
| CSS support | CSS 2.1 | CSS3 |
| SVG | Limited | Full SVG 1.1 |
| JavaScript | Not supported | Supported (scripted) |
| MathML | Not supported | Native |
| Audio/Video | Not supported | HTML5 <audio> / <video> |
| Navigation | NCX (toc.ncx) | nav.xhtml |
| Fonts | OpenType | OpenType, WOFF, WOFF2 |
| Accessibility | Limited | DPUB-ARIA, Schema.org |
| Fixed layout | Limited | Full specification |
| Pronunciation | Not supported | PLS + SSML |
EPUB 3 is the standard for new publications. EPUB 2 is still read by all major readers for backwards compatibility.
Fixed Layout vs. Reflowable
Reflowable EPUB (default): text reflows to fit the reader's screen, font size, and orientation. Ideal for novels, textbooks, and most prose.
Fixed layout EPUB: each page has a fixed pixel size, like a PDF. Used for children's picture books, comics, and design-heavy magazines:
<!-- OPF metadata for fixed layout -->
<meta property="rendition:layout">pre-paginated</meta>
<meta property="rendition:orientation">landscape</meta>
<meta property="rendition:spread">landscape</meta>
<!-- Per-item override in manifest -->
<item id="page01" href="page01.xhtml" media-type="application/xhtml+xml"
properties="rendition:layout-pre-paginated rendition:spread-none"/>
/* In the content document */
html { width: 1024px; height: 768px; }
Media Overlays (Read-Aloud)
EPUB 3 supports synchronized text and audio via SMIL Media Overlays — the e-reader highlights text as it reads aloud:
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0">
<body>
<seq id="s1" epub:textref="Text/chapter01.xhtml"
epub:type="bodymatter chapter">
<par id="par01">
<text src="Text/chapter01.xhtml#para01"/>
<audio src="Audio/chapter01.mp3" clipBegin="0:00:00.000"
clipEnd="0:00:04.500"/>
</par>
</seq>
</body>
</smil>
This is the basis for accessible read-aloud books for visually impaired readers.
DRM and Adobe Digital Editions
DRM (Digital Rights Management) in EPUB is typically implemented via Adobe Content Server (for ACS4/ADEPT DRM) or Apple's FairPlay. DRM restrictions are stored in META-INF/encryption.xml. DRM-protected EPUBs cannot be read by all readers — only those licensed by the DRM provider.
Kindle note: Amazon uses its own formats (AZW, MOBI, KFX) that are not EPUB. Conversion from EPUB to Kindle formats is handled by Calibre or Amazon's online converter. Kindle Scribe can now open EPUB files natively (from 2023).
Creating EPUB Files
Pandoc (command-line, free):
pandoc input.docx -o output.epub --epub-cover-image=cover.jpg
pandoc input.md -o book.epub --toc --metadata title="My Book"
Sigil (free, open-source EPUB editor): full GUI for creating and editing EPUB 2/3 with syntax highlighting and validation.
Calibre (free): converts between formats and can edit EPUB metadata. Not recommended for creation of polished EPUBs.
Adobe InDesign: industry standard for publishing — exports directly to EPUB 3 with fixed or reflowable layout.
Jutoh / Vellum / Atticus: consumer tools optimized for self-publishing authors.
Validating EPUB
EPUBCheck (official W3C validator):
java -jar epubcheck.jar book.epub
java -jar epubcheck.jar book.epub --json report.json
EPUBCheck validates:
- ZIP structure (mimetype placement, required files)
- OPF wellformedness and required metadata
- Navigation document structure
- All referenced files exist in manifest
- HTML/CSS validity
- Accessibility metadata (EPUB 3)
A valid EPUB passes EPUBCheck with 0 errors and 0 warnings.
Converting EPUB
- EPUB → PDF: Calibre
ebook-convert input.epub output.pdf, or Adobe InDesign export. - EPUB → MOBI/AZW3: Calibre, or Amazon KindleGen (discontinued; now Amazon's online converter).
- EPUB → DOCX: Pandoc
pandoc input.epub -o output.docx. - EPUB → HTML:
unzip book.epub -d book_html/— the XHTML files are directly readable. - DOCX → EPUB: Pandoc, or Word → Save as Filtered HTML → Sigil.
- PDF → EPUB: Calibre (lossy — layout may degrade), or professional OCR workflow.
Best Practices
- Validate with EPUBCheck before distributing — invalid EPUBs break on many readers.
- Use UTF-8 encoding in all content documents and declare it in the XML declaration.
- Include cover image in the manifest with
properties="cover-image"for store thumbnails. - Embed only required fonts — unused font files increase file size unnecessarily.
- Test on multiple readers: Kindle Previewer, Apple Books, Kobo, FBReader, and browsers via epub.js.
- Separate content from presentation — keep CSS in external stylesheets, not inline styles.
- Use semantic markup (
epub:typeattributes) for accessibility and navigation. - Keep image file sizes small: JPEG for photos (< 200 KB), PNG for diagrams with few colors.
- Preserve NCX file (toc.ncx) even in EPUB 3 for compatibility with EPUB 2 readers.
- Use Pandoc for batch conversions — it handles most office formats to EPUB reliably.
Related conversions
Document conversions that follow this topic naturally: