Start by doing it. If you have an EPUB to hand, this is all it takes.
.epub to .zip That is it. No special software. An EPUB is a ZIP, so it unpacks without so much as a warning.
You might think "if it unzips, then zipping a folder and renaming it to .epub makes an EPUB". It is not that simple, because of the rules about how it must be compressed described in the next section.
Unpacked, it generally looks like this.
OEBPS — that folder name, and how things are divided inside it, vary by the tool that built it. It might be item or xhtml instead, and that is fine.
What you cannot change, in name or position, is mimetype at the front and META-INF/container.xml . Those two are fixed and everything else is free — that is step one in understanding the structure.
Its contents are a single line.
Its job is to declare "this ZIP is an EPUB". But it comes with strict rules no other file has.
A reading app can decide "this is an EPUB" by reading only the first few bytes of the file. That is why the position and form are pinned down.
Zip a folder with an ordinary compression tool and you cannot choose the file order, and mimetype gets compressed along with everything else. The result: rename it to .epub and reading apps will not open it.
Meeting the "first, uncompressed" condition means running the compression in two separate steps. That is the very first thing an EPUB-building tool does.
META-INF/container.xml looks like this.
It does exactly one thing: it says "the book details are in OEBPS/content.opf ".
That signpost is why folder names can be free. A reading app looks at META-INF/container.xml first and goes wherever it points.
This is the most important file in an EPUB. It splits into three parts.
| Part | What it does |
|---|---|
| metadata | Title, author, language — the book’s own details |
| manifest | A list of every file included |
| spine | The order pages are turned in |
The one to watch is dc:title . What appears on the shelf in a reading app is this value, not the file name. However carefully you named the file, if this is empty the shelf shows "Untitled".
dc:language matters too. Put en for English, ja for Japanese. Without it, a reading app may not apply the typesetting rules for the language — which bites hardest in Japanese.
Every file in the EPUB has to be registered here. Add one image and forget to register it and that alone is an error. The reverse — registered but not actually there — is an error too.
The table-of-contents file is marked with properties="nav" , which is how it says "this file is the contents".
manifest is the list of what is inside; spine is what order it is read in. The order here becomes the page order.
And the part that matters most for a Japanese book is page-progression-direction .
| Value | Meaning | Books that use it |
|---|---|---|
| rtl | Progresses right to left | Vertical text, manga |
| ltr | Progresses left to right | Horizontal text |
Leave this out of a vertically set book and pages turn the wrong way. It is one of the first things to check when vertical text is not working.
EPUB 3 always requires the table of contents as its own file. It looks like an ordinary HTML list of links, distinguished by the marker epub:type="toc" .
This is what comes up when a reader presses the contents button. If a linked file is missing, you have a book you cannot navigate.
In older EPUB 2, a file called toc.ncx did the job of the contents. EPUB 3 replaced it with nav.xhtml , but some EPUBs include both so that older reading apps still work.
From here on it is much the same as a web page.
How you divide the text is up to you, but one file that is too large makes reading apps sluggish, so splitting by chapter is the norm.
As you have seen, the structure of an EPUB is not complicated. Text, images and design instructions packed into a box with a signpost and a list — that is all.
The rules to obey, though, are finicky.
mimetype goes in first, uncompressedmanifest spine Miss one and the book fails to open, or gets bounced at store submission. And the cause of the error is usually not visible from what you see on screen.
So in real production people use a tool that assembles the structure from a manuscript or images. Even so, having looked inside once means you can guess where to look when something goes wrong — which is the point of this article.
EPUB FACTORY builds every part of the structure described here automatically. Just pick a folder of images or a text manuscript. No account, no installation.
Try EPUB FACTORY