Ahab! is a simple template for producing Kindle specific .mobi files which can be used to publish on Amazon.com.

The template is available on github.com/cmod/ahab/


Mobi is Kindle's ebook format. It's sort of like epub's step-brother. With a properly formatted .mobi file you can publish on the Kindle Direct Publishing platform.

This template

This template is meant to get you from thinking about publishing a piece of text you have to actually publishing it on Kindle Direct Publishing. If you have a long-form blog post composed mainly of text, I suspect you could convert it to a proper .mobi file using this template in fifteen minutes. Obviously, more complex texts (and cover production, etc) take more time.



Amazon revised their cover guidelines in early 2012. Here's the latest:

Here are the base requirements:

Requirements for the size of your cover art:

  • Minimum of 1000 pixels on the longest side
  • Ideal height/width ratio of 1.6

For better quality, we recommend that images be 2500 pixels on the longest side.


Kindle Format 8 supports CSS media queries. It seems a little bit out of the scope of a baseline template, but if you're interested, Liz Castro explains all.

@font-face rules only work on Kindle Fire.

The full list of KF8 HTML and CSS support:

What are these other files?

toc.ncx and content.opf are the two slightly alien files of this collection.

OPF means "Open Page Format". From Wikipedia:

The OPF file, traditionally named content.opf houses the EPUB book's metadata, file manifest, and linear reading order. This file has a root element package and four child elements: metadata, manifest, spine, and guide. All of these except guide are required. Furthermore, the package node must have the unique-identifier attribute. The .opf file's mimetype is application/oebps-package+xml.

The .ncx file is explained thusly:

The NCX file (Navigation Control file for XML), traditionally named toc.ncx, contains the hierarchical table of contents for the EPUB file. The specification for NCX was developed for Digital Talking Book (DTB), is maintained by the DAISY Consortium, and is not a part of the EPUB specification. The NCX file has a mimetype of application/x-dtbncx+xml.

Exciting stuff! *zzzzzz*

We've done our best to obviate thinking too much about those files.


So you have your cover. You have your properly formated .mobi. You've tested it in Kindle Previewer and it looks pretty good on all devices. Now, how do you publish?

You can just mail the .mobi file to friends, put it up on a server, upload it to a forum — distribute any way — and any Kindle will be able to open the file.

But if you want to "publish" it on Amazon — set prices and get it properly listed —  then Kindle Direct Publishing is what you want. It should be pretty self explainatory.


This is by no means exhaustive. It's meant to give anyone interested in .mobi a little boost. The gunk has been stripped. What's remaining should be self explanatory.

Similar projects


If you do end up making a publishing something with this, please let us know. Post about it in the github project or shoot me an email: yes@prepostbooks.com