Open source tools to prepare your ebooks for publication

No readers like this yet.
Publishing the open source way

Self publishing a book has never been easier. There are numerous open source tools that you can use to create a book.

Having published three ebooks, and being in the process of putting together another one, I’ve learned that after writing a book there are a few more things that you need to do before sharing your book with the world.

If you're publishing your book in the EPUB format, you need to check the book to ensure it's properly formed. And, if you're selling your book through's Kindle Library, you need to convert your EPUB to the format that the Kindle supports.

Let’s take a look at two tools that enable you to do both.


EPUB files are very structured. It's not just the chapters (which are made up of individual XHTML files) but also the way in which those chapters, the supporting files (like images and Cascading Style Sheet files), and the directories inside an EPUB file are arranged.

No matter how careful you are or what tool you’re using to create or assemble a book in EPUB format, a few mistakes can creep in. That’s why you need to validate your book before setting it loose. Validation is the process of making sure that your EPUB books contain all the elements that ebook readers expect. Like what? Here’s a partial list:

  • Complete metadata
  • The proper directory structure in the EPUB file
  • Valid XHTML
  • Working links and references to files in the EPUB file
  • A table of contents

An ebook reader can usually open an EPUB file that doesn't validate. However, the contents might not render properly and the navigation might not work.

A command line tool called epubcheck makes validation fairly easy. epubcheck is a Java application, so make sure you have a fairly recent JRE installed on your computer before trying to use it. If you're averse to the command line, don't worry: there's also an online validator available.

To use epubcheck, run this command:

java -jar epubcheck–3.0b5.jar ebook_file.epub

Here are the results when epubcheck is run against a partially-completed ebook:

Checking an EPUB with epubcheck

In the example above, the file names of the individual chapter titles contain spaces. That's not a massive sin, but one which can cause problems.

epubcheck is great at finding problems. But in many cases, it's lacking when it comes to explaining what those problems are. epubcheck assumes that you have a level of knowledge and the knowledge to fix the problem. That’s not always the case.

When a writer of my acquaintance was validating an ebook, he got an error message telling him that there was invalid HTML syntax in a particular file. He has a decent knowledge of HTML and went to the line number that epubcheck pointed to in the file. He didn’t see anything wrong. He enlisted my help, and we discovered that epubcheck was expecting paragraph tags around text surrounded by blockquote tags.


Like it or hate it (and there are many people across that spectrum), Amazon is the biggest and arguably most popular marketplace for publishing, selling, and buying books. Amazon, however, uses a proprietary format with the extension .mobi. Apart from a web-based authoring and publishing tool called BookType, there aren’t any open source tools for creating books in the .mobi format.

You can convert your ebooks to .mobi using a command line tool called ebook-convert. It's part of the suite of utilities that comes with the calibre ebook management software.

To convert an EPUB file to .mobi, run the command:

ebook-convert ebook_file.epub

Depending on the size of your file, the conversion will anywhere from 5 to 20 seconds. Here’s what the tool returns at the command line when you run it:

Converting an EPUB to .mobi

Here’s what an EPUB converted to .mobi looks like when viewed in calibre:

Viewing the converted .mobi file

The only problem I've encountered with the conversion is that ebook-convert duplicates the cover page. Other than that, it does just as good a job of converting EPUB files to .mobi as Amazon's proprietary Kindlegen conversion tool.

With all that out of the way, you're ready to share your book with the world.

That idiot Scott Nesbitt ...
I'm a long-time user of free/open source software, and write various things for both fun and profit. I don't take myself all that seriously and I do all of my own stunts.


I'm always interested in articles like this because I've been writing stories using free software, and releasing them CC-BY-SA. You can find them here - It might be interesting to see how they've evolved over time.

At first I used the LibreOffice extension called writer2epub - - to convert from ODT to ePub. It's a handy tool if you want to output directly from the word processor. Lately, though, I've been using Calibre to do the conversion, and I like it a lot.

So far I haven't needed to convert to Amazon's proprietary format, but if I go that route I'll certainly look at the software you mentioned. Thanks again for the article.


You might want to check out this article by Bryan Behrenshausen. It's a detailed look at Writer2EPUB, one that I learned a few things from.

In reply to by arjaybe (not verified)

I'm surprised that Sigil ( is not in the list. If you want to develop your book directly in ePub format (as opposed to developing it in some other format and then converting) Sigil is the place to start. Else, you can use it for checking the last bits (TOC, cover, etc.) before publishing your book.

PS: I'm in no way affiliated with the Sigil development team, just a happy user.

Sigil was on the list, but it was cut because of space restraints. I use it extensively, and really like the FlightCrew validator that comes with it.

However, this article isn't about ebook authoring tools. It's about tools for preparing your ebook for publication.

In reply to by gurdulilfo

Instead of using JAVA based solutions why not use GitBook?

One of the article ideas that's on my list (either for or my own blog is an in-depth look at GitBook. All I need is several long blocks of time to put it through its paces.

While GitBook can save files at EPUB or .mobi, does it have a validator function?

In reply to by Arun (not verified)

You should also check on Booktype.

I've used BookType (and its predecessor, Booki) to write three books and can attest to its usefulness as a tool for writing and publishing books -- whether by one author, or when several collaborate on a book.

Again, I'll stress that this article isn't about ebook authoring tools. It's about tools for preparing your ebook for publication.

In reply to by Magdalena (not verified)

Nice article! Awareness that this can be done by an individual and how to go about it is still minimal. Some comments:
Kindlegen was extremely frustrating to use for Mobi conversion and the results were....wobbly! Calibre does a painless and excellent convert to contest!
Epubcheck can be run with a GUI like Pagina's epubchecker...this is worthwhile because the online checker takes quite a lot of time, has a filesize limit (10MB I believe) and requires internet access and authors are often not at all comfortable with the CLI. Tracking down batches of errors and having to re-upload each time is IMHO silly, given that CLI tools can be wrapped.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.