mcloud88

What is actually inside an EPUB file

Aug 23, 2026

An EPUB is a ZIP archive with a few conventions. Once that clicks, most “broken book” problems become easy to diagnose.

The pieces

mimetype comes first and is stored uncompressed. META-INF/container.xml points to the package file, usually named content.opf. The package file lists every resource (the manifest) and the reading order (the spine).

The chapters themselves are ordinary XHTML documents with CSS and images next to them. The table of contents is either an old toc.ncx or a newer navigation document, and plenty of books ship both.

Where things go wrong

Text files in odd encodings, chapter files without extensions, entities escaped twice so a non-breaking space shows up as literal text — all of these come from older conversion tools. Reading the spine instead of guessing file order solves a surprising share of them.