What An Epub File Is, and How To Open, Edit, and Create Your Own

For many today, e-books revolutionized how content is consumed. E-books grant on-demand access to written content across every platform and device imaginable. EPUB, which is short for electronic publication, is the most widely used file format for digital books and is considered by many to be the industry standard.

What Is an EPUB?

Essentially, the EPUB format is an archive that houses what is effectively a website. EPUB files package and encode enhanced web content for distribution within a single file. Each EPUB file contains the structural data, HTML files, CSS style sheets, images, and any other assets that are required to display the content.

By default, EPUB content is reflowable, meaning that the content adapts itself to fit the screen on which it is displayed, however, content can also be coded to display in a static fashion. The latest version of EPUB, EPUB3, is based around the HTML5 standard and can now include multimedia content such as audio, video, as well as interactive components, though, not all e-readers will be able to display such content.

Deconstructing the Structure and Content of an EPUB

EPUB documents are a zipped archive that contains interrelated resources within a single file. There are three primary components that make up the basic skeleton an EPUB archive. A valid EPUB file must contain all three components.

Mime Type

The MimeType file is a basic ASCII text file that is located at the root of the archive. The purpose of the MimeType file is to basically declare to the reading system how the archive is formatted and how it should be processed. All MimeType files used in EPUBs are the same and need only include a single declarative line: application/epub+zip.

META-INF

The META-INF folder contains the e-book’s metadata information.  The META-INF typically only contains a single XML file: container.xml. The purpose of this mandatory XML file is to point to the location of the ‘package.opf’ file, which instructs the reading application on where to find and how to process the contents of the e-book.  Apart from the ‘container.xml’ file, the META-INF directory may hold other documents that contain information about the EPUB itself, such as embedded fonts and DRM encryptions.

OEBPS

The OEBPS folder is where the actual contents of the e-book are stored. This folder houses the text, images, fonts, and stylesheets that are required to display the e-book on screen. The OEBPS folder consists of three mandatory declarative files — the .opf, .ncx, and .css files — as well as all of the files that make up the contents of the EPUB document.

*.opf

The .opf file — typically named package.opf or content.opf — is an XML file that contains the structural data of the EPUB. It is the primary source of information about how content should be processed and displayed and consists of four different sections:

  • <metadata> The metadata section contains all of the meta information about the EPUB document, such as title, author, cover, synopsis, publication language, publisher, copyright, etc.
  • <manifest> The manifest is an exhaustive list of all of the assets that make up the publication, including XHTML chapters, images, fonts, CSS files, and scripts.
  • <spine> The spine is where the default reading order of all the publication’s chapters — the HTML/XHTML files that comprise the actual content — is laid out.
  • <guide> The guide points towards the e-book’s cover, table of contents, and the actual beginning of the e-book’s text. The guide section has been deprecated as of EPUB3, but some vendors still make use of it.

*.ncx

Typically named ‘toc.ncx’, the .ncx file is an XML file that handles the navigational table of contents in the e-book. It is used to establish navigation between elements within the book and where the elements appear within the navigational table of contents. The use of .ncx files has been deprecated as of EPUB3, but many publishers still include it so that EPUB2 reading systems will still be able to process the document.

*.css

The cascading style sheet is required to instruct the reading system on how to display different elements of the EPUB. It functions just like cascading style sheets on normal web pages and is what is used to actually declare the formatting specifics — such as the weight, size, and colors of fonts, page and paragraph margins and paddings, etc. — for how the information within the publication is displayed.

How To Open an EPUB File for Viewing

With the exception of the Amazon Kindle app, EPUB files can be opened by most any e-book reader. Readers exist for just about all major desktop and mobile platforms. There are many paid and free e-reader options available

Keep in mind that some EPUB files are protected using Digital Rights Management (DRM), which means they are only able to be opened on certain authorized devices or apps. Typically, e-readers will not support DRM-protected EPUBs from other platforms.

Free Cross-Platform E-Reader Solutions

Adobe Digital Editions is a free program for use on Windows, Mac, iOS, and Android that allows you to open and view standard EPUB documents. Adobe Digital Editions must be downloaded and installed to your computer to use. You can download a free copy of Adobe Digital Editions from the Adobe website.

Calibre is a an open-source e-book management tool that can be used on Windows, Mac, and Linux operating systems. Calibre allows you to organize your digital books into a virtual library that can be synced up with a number of e-readers.

FBReader is another popular open-source e-book reader. FBReader, short for Favorite Book Reader, is a highly-customizable free cross-platform reader that is available on Android, iOS, Linux, and Windows.

Google Play Books allows you to upload your own EPUB files for viewing either within your web browser or in the Google Play Books app, which is installed by default on most Android devices and is also available as a free download for iOS.

Kobo is a free-to-use reading app developed by the makers of the Kobo e-reader. The Kobo reading app allows you to either purchase e-books from their storefront or sideload your own EPUB files. The Kobo reading app is available for use on most platforms, including Mac, Windows, Android, Blackberry, and iOS.

How To Create and Edit an EPUB File

There are three basic ways that you yourself can create an EPUB file, each having their own tradeoff in quality or time involved in the process.

Create the EPUB from Scratch

As most of the contents of an EPUB are just what you’d find when working on a straightforward website, if you’re already comfortable hand coding website assets such as XHTML and CSS files, then creating an e-book from scratch may be the easiest and cleanest solution. Just like a typical website, all of these assets can be hand coded from scratch using either a basic text editor or webpage editing software such as Dreamweaver. Applications like Sigil and Calibre offer both a WYSIWYG editing experience as well as the ability to view and edit the actual code of the files.

Use an Application That Can Export EPUB Files

Some editing applications, either by default or through the use of plugins, have a means of exporting directly to EPUB format. For example, Apache’s OpenOffice is a free office suite that allows you to save your manuscript as an e-book through the use of a plugin called Writer2ePub. Of course, there are commercial solutions that have been created exactly for the purpose of preparing publications. ScrivenerAdobe InDesign, and QuarkXpress are the most popular commercial options available for creating and editing EPUB files.

Convert to EPUB Using an Application or Online Service

Since most e-books will begin their life as a manuscript written in a word processing application like Microsoft Word or OpenOffice, using an app to convert the file from one format to another may seem like the easiest solution. Calibre can convert between an impressive number of formats, including HTML, DOCX, RTF, and MOBI, among others. There are free online tools available, which will allow you to upload your file and then download a converted EPUB. The biggest downside of conversion is that, in most cases, the formatting will need to be cleaned up after the fact.

Whichever method you use to create an EPUB, it’s highly recommended that you validate the final EPUB file using the free, open source tool EpubCheck validator, which will check the EPUB for errors within its structural markup, image, and HTML files.