All Collections
Author Help
Debugging EPUB Validation Errors
Debugging EPUB Validation Errors

Keywords: EPUB, error, errors, validation, check

Leanpub Support avatar
Written by Leanpub Support
Updated over a week ago

We sometimes do EPUB file debugging on the Leanpub side of things.

For advanced authors, who know about checking EPUB files for validation errors, we just thought we'd share an (edited) article from our internal corporate wiki on this topic.

So, an EPUB is basically a zipped batch of HTML files.

That means you can unzip it to inspect individual files (which will typically be individual chapters).

This may be required if you find you are getting validation errors when you check the EPUB using one a tool like this one.

Download the EPUB file to your computer and pick a relevant place to create a folder called inspect-epub (it can actually be named anything you like of course):


In Terminal (on a Mac), go to the inspect-epub folder and type unzip [filename].

That will get you a result like this:


We're interested in the .xhtml files in the OEBPS folder:


If you open up the file, you'll see stuff like this:


Now, you can use the line numbers and the EPUB validation error report you generated with an EPUB validation tool, to look for what's causing the EPUB validation error.

Inspecting an EPUB file Part Deux: Rezipping the corrected file to test it

After identifying the potential cause of the EPUB validation error, you may want to test to see if your guess was right.

To do this, make your correction in the relevant .xktml file and save it.

Now, select the unzipped folders and zip them back up. To do this, select the files, right-click on them, and select "Compress" (on a Mac):


That will get you a folder called


Rename it to something appropriate, with the file extension .epub:


You can now open the file as an ebook and check it using an EPUB validator.

OK, that's it!

If you have any feedback or questions about this article, please email the Leanpub team about it at!

If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!

Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes:

Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!

Subscribe to our YouTube channel here:

Please subscribe to our YouTube channel here:

You can also follow Leanpub in lots of other places!

Did this answer your question?