EPUB (Electronic Publication) — Complete Ebook Format Guide
What Is EPUB?
EPUB (Electronic Publication) is an open, free, international standard for ebook formatting, developed and maintained by the W3C EPUB Working Group (formerly IDPF — International Digital Publishing Forum). Published as ISO/IEC TS 30135 and available as an open specification, EPUB is the dominant ebook format for trade publishing, academic publishing, and library distribution worldwide.
EPUB defines a packaging format that combines XHTML or HTML content, CSS styling, SVG graphics, metadata, and navigation into a single ZIP-based container. The reflowable nature of EPUB content means text wraps to fit any screen size and the reader's preferred font size — unlike PDF, which maintains fixed page layouts.
Current version: EPUB 3.3 (W3C Recommendation, May 2023, backward-compatible with EPUB 3.2)
EPUB Container Architecture
An EPUB file is a ZIP archive with the .epub extension:
book.epub (ZIP)
├─ mimetype — "application/epub+zip" (must be first; uncompressed)
├─ META-INF/
│ ├─ container.xml — points to the Package Document (OPF file)
│ └─ encryption.xml — DRM/encryption data (if present)
├─ OEBPS/ (or any directory name)
│ ├─ content.opf — Package Document (metadata, spine, manifest)
│ ├─ toc.ncx — EPUB 2 navigation (legacy; for backward compat)
│ ├─ nav.xhtml — EPUB 3 navigation document (TOC, landmarks)
│ ├─ chapter01.xhtml — Chapter 1 text content
│ ├─ chapter02.xhtml — Chapter 2 text content
│ ├─ stylesheet.css — Book styling
│ ├─ images/
│ │ ├─ cover.jpg — Cover image
│ │ └─ fig01.png — Figure
│ └─ fonts/
│ └─ PublicSans-Regular.woff2 — Embedded webfont (EPUB 3)
container.xml
<?xml version="1.0" encoding="UTF-8"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="OEBPS/content.opf"
media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
Package Document (content.opf)
The OPF (Open Packaging Format) file is the central manifest:
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier id="uid">urn:isbn:978-0-000-00000-0</dc:identifier>
<dc:title>Book Title</dc:title>
<dc:creator id="creator">Author Name</dc:creator>
<dc:language>en</dc:language>
<dc:publisher>Publisher Name</dc:publisher>
<dc:date>2024-01-01</dc:date>
<dc:rights>Copyright 2024 Author Name</dc:rights>
<meta property="dcterms:modified">2024-01-01T00:00:00Z</meta>
<meta property="schema:accessMode">textual</meta>
<meta property="schema:accessibilityFeature">tableOfContents</meta>
</metadata>
<manifest>
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml"
properties="nav"/>
<item id="ch01" href="chapter01.xhtml" media-type="application/xhtml+xml"/>
<item id="cover-img" href="images/cover.jpg" media-type="image/jpeg"
properties="cover-image"/>
<item id="css" href="stylesheet.css" media-type="text/css"/>
</manifest>
<spine>
<itemref idref="ch01"/>
<itemref idref="ch02"/>
</spine>
</package>
The spine defines the reading order — which documents the reader presents in sequence.
EPUB 2 vs. EPUB 3
EPUB 2 (2007)
- Uses XHTML 1.1 for content
- Navigation via NCX (Navigation Control XML) — hierarchical TOC
- Limited CSS (CSS 2.1 subset)
- No native audio/video embedding
- No JavaScript
- Status: widely supported by older readers; deprecated but still common in legacy ebooks
EPUB 3 (2011, current: 3.3)
- Uses HTML5 for content (full HTML5 document model)
- Navigation via dedicated navigation document (NAV XHTML)
- Full CSS 3 support (subsets vary by reading system)
- Media overlays — audio narration synchronised with text (SMIL; enables audio books with highlighted word-by-word text)
- JavaScript support (optional; not all reading systems execute scripts)
- MathML for mathematical notation
- SVG inline in content
- Ruby annotations for East Asian typography
- Structural semantics via
epub:typeattribute (chapter, part, bodymatter, dedication, epigraph, etc.) - Status: current standard; supported by Apple Books, Kobo, Adobe Digital Editions, Thorium Reader
Reflowable vs. Fixed Layout
Reflowable (Default)
Text flows to fit the reading system's viewport. The user can:
- Adjust font size (text reflows to fit)
- Switch fonts (reading system fonts or embedded fonts)
- Change colour scheme (day/night/sepia)
- Adjust line spacing and margins
- Use text-to-speech accessibility features
Reflowable is appropriate for: novels, non-fiction prose, academic papers, any text-heavy content.
Fixed Layout (FXL)
The document specifies exact pixel dimensions. Content is positioned precisely like PDF:
<meta name="fixed-layout" content="true"/>
<meta name="original-width" content="800"/>
<meta name="original-height" content="1067"/>
Fixed layout is appropriate for: children's picture books, comics/manga, cookbooks with complex layouts, coffee table books, technical manuals with precise diagram positioning.
Trade-offs of FXL: fonts cannot be resized; text is not searchable unless explicitly encoded; accessibility features (screen readers) work poorly; small screens require horizontal scrolling or zoom.
EPUB Accessibility (EPUB 3)
EPUB 3 incorporates comprehensive accessibility support aligned with WCAG 2.1:
- Reading order — linear reading order defined in spine ensures screen readers navigate correctly
- Alt text —
altattributes on all images - ARIA roles and
epub:type— semantic markup for assistive technologies - Language declaration —
xml:langon all text for correct text-to-speech pronunciation - Tables — proper
<thead>,<th>markup for accessible table reading - Media overlays — synchronised audio narration highlights text word-by-word (DAISY compatibility)
- Schema.org accessibility metadata — declares accessibility features in OPF metadata (
accessMode,accessibilityFeature,accessibilityHazard,accessibilitySummary)
EPUB 3 is the first ebook format with comprehensive built-in accessibility standards, enabling readers with visual impairments to use the same ebook files as sighted readers.
DRM in EPUB
Adobe Digital Editions (ADEPT DRM)
Used by: public libraries, academic publishers, Kobo, Barnes & Noble (Nook), many independent publishers. EPUB files with ADEPT DRM are locked to specific Adobe ID accounts and authorised devices.
Apple FairPlay (iBooks DRM)
Used exclusively for: Apple Books store. Protected EPUBs play only in Apple Books on Apple devices.
Readium LCP (Lightweight Content Protection)
Open standard DRM developed by EDRLab; supported by Thorium Reader, Kobo, and major European library systems. Less restrictive than ADEPT; supports library lending models.
DRM-Free EPUB
Available from: Project Gutenberg (public domain), Smashwords, Standard Ebooks, Tor.com (DRM-free policy), Humble Bundle. DRM-free EPUBs are portable — read on any compatible device.
Converting EPUB
EPUB → PDF: Convert for printing or reading on PDF-centric devices; fixed layout; no reflowing; Calibre (free) or KaijuConverter recommended EPUB → MOBI: Convert for older Kindle devices (Kindle uses KFX/AZW3 natively; MOBI for legacy); use Calibre EPUB → AZW3: Kindle's modern format; higher-quality Kindle conversion; Amazon KDP auto-converts EPUB uploads EPUB → DOCX: Extract content for editing in Word; some formatting preserved EPUB → HTML: Extract chapters as web pages; useful for web publishing PDF → EPUB: Difficult; PDF's fixed layout rarely converts well to reflowable EPUB without manual cleanup
Related conversions
Document conversions that follow this topic naturally: