Introduction to EPUB Files

This Introduction to EPUB Files breaks down the elements that make up an EPUB.

  • Subject(s):

    Ebook Production

  • Resource Type(s):

    Foundations and Rationale

  • Audience:

    Technical

What is an EPUB File?

This is a great question to ask. Even if you have been working with EPUB for a while, it is entirely possible and understandable that you might not know what makes it up!

An EPUB contains a set of files that make up the ebook. The files are packaged together, and that is what you are seeing when you look at an EPUB. You are probably familiar with unzipping .ZIP folders — well you can do the same with an EPUB, just by changing the file extension to .zip. Do this, and you can unzip the file to see the contents of the EPUB. (To change it back, simply change the file extension back, to .epub.) (Note that you may need another app or program to unzip the file, if your system won’t do it automatically – try The Unarchiver for Mac, or StuffIt for both Mac and PC.)

Inside the unzipped folder, you will see a document called mimetype, and two folders: “META-INF”, and “OPS” or “OEBPS” (OEBPS and OPS are the same thing, and you may see either name. They stand for OpenEbook Publication Structure and OpenPublication Structure – but this isn’t super important to know!).

The mimetype file tells the computer what the file is — simple! It has no extension, and just a single line of code:

application/epub+zip

The META-INF folder has one file in it: container.xml. This file points the reading system to the all-important OPF file (which we haven’t discussed yet – don’t worry!) The file will almost always consist of the following (if the book has an OPS file – otherwise, switch out OEBPS for OPS):

<?xml version="1.0" encoding="utf-8"?>
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
<rootfiles>
<rootfile full-path="OPS/content.opf" media-type="application/OPS-package+xml"/>
</rootfiles>
</container>

The OPS/OEBPS folder contains all of the content of the book itself — the text, the images, the CSS, fonts, other media files if they exist, etc. It also contains the navigation file (usually toc.xhtml or nav.xhtml) and the OPF. Sometimes, there is an NCX file — this is an older type of navigation file. The OPF is a complex document, which warrants its very own resource — see Related Content below. 

All these items — the mimetype, META-INF, and the OPS/OEBPS folder with its CSS, XHTML/HTML documents, fonts, images, media, navigation file, and OPF, are all packaged together to create your wonderful EPUB. And, in case you were wondering, you can absolutely build up an EPUB from scratch, and make each one of these files. It’s a great way to learn!

Next Steps

1

Understanding the Navigation File in EPUB 3

Introduction to the Navigation File

This Introduction to the Navigation File of an EPUB breaks down the elements that make up this important file.

Subject(s): Ebook Production
Resource Type(s): Checklist, Foundations and Rationale, Standards and Best Practices
Audience:
Technical
2

Understanding the OPF File

Introduction to the OPF File

The OPF file is an extremely important — and extremely complex! — document in an EPUB. This Introduction to the OPF file breaks down its contents.

Subject(s): Ebook Production
Resource Type(s): Foundations and Rationale
Audience:
Introduction

External Links to More Information

Anatomy of an EPUB 3 file

This page gives an overview of how an EPUB file is structured. It covers the mimetype identification file, the container.xml file, and the OPF file.

What’s in an EPUB File?: The OPS Folder

This page breaks down the contents of the OPS (or OEBPS) folder, which contains all of the files and documents that make up the contents of an ebook.

Content Source Acknowledgement