How We Published a Book!, Part 1: Publishing to Kindle

In the last few weeks, a project that I was working on with my wife and father-in-law came to fruition: we published a book! Specifically, he wrote the book, Robin helped edit, and I helped him to publish it in both Kindle format and paperback.

TOTALLY BIASED ENDORSEMENT: If you are a runner and looking for some inspiration and lessons learned, I highly recommend it!

It was a long process (over a year, on and off!) and I relied heavily on other bloggers to find tips and tricks to make it all work. I decided that I ought to pay it forward and talk through the process we followed, and the lessons learned. (Ok, I admit that this is as much for remembering it myself when the next book comes around as it is for everyone else to learn.)

These posts will consist of three parts: this one, the first, will explained the process of getting a Kindle book published through Kindle Direct Publishing, or KDP. The second will explain how we generated a PDF and cover to publish a paperback through Createspace. The third and final post will detail a few lessons learned that we will use for the next book and what we recommend to any aspiring self-publishing authors.

Ok, let’s get down to business. One of the best sources I used for creating the Kindle version of the book was How to Make a Kindle eBook from Scratch by Alicia Ramirez.


There are three files that you need to have outside the book content. The first two are basically text files with some specialzed tags. First, you’ll need an OPF (Open Packaging Format). The OPF is mostly card-catalog data, including the name of the book, author, and publishing details, plus a list of the files included in the book (called the ‘manifest’). That text file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<package unique-identifier="uid" xmlns:opf="" xmlns:asd="">
<dc-metadata  xmlns:dc="" xmlns:oebpackage="">
<dc:Title>Running Around The World: Lessons Learned from Life on the Roads</dc:Title>
<dc:Creator>David Bishop</dc:Creator>
<dc:Copyrights>David Bishop</dc:Copyrights>
<dc:Publisher>David Bishop</dc:Publisher>
<meta name="cover" content="images/Cover5a.jpg">
<item id="ncx" media-type="application/x-dtbncx+xml" href="ratw.ncx"/>
<item id="ratw" media-type="text/x-oeb1-document" href="ratw.html"/>
<item id="cover" href="images/Cover5a.jpg" media-type="image/jpeg">
<item id="mobicss" media-type="text/css" href="mobi.css"/>
<item id="ratwcss" media-type="text/css" href="ratw.css"/>
<spine toc="ncx">
<itemref idref="ratw"/>
<reference type="text" title="Book" href="ratw.html"/>

Additionally, you’ll require an NCX (Navigation Center eXtended) file, which is a set of links to allow your readers to use the Kindle “slide-in pane” to navigate through the book. This isn’t strictly speaking necessary, but it is super annoying to find your place in a book without it. The NCX is also in a text file, using XML syntax. Note the bits that say <content src="ratw.html#something"> — for each of those, there needs to be an HTML tag in the body content that says something like, <h3 id="something>Something</h3>.

<?xml version="1.0"?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
<ncx xmlns="" version="2005-1">
<text>Running Around the World: Lessons Learned from Life on the Roads</text>
<navPoint id="navpoint-1" playOrder="1"><navLabel><text>Front Matter</text></navLabel><content src="ratw.html#kathy"/></navPoint>
<navPoint id="navpoint-1" playOrder="1"><navLabel><text>Table of Contents</text></navLabel><content src="ratw.html#toc"/></navPoint>
<navPoint id="navpoint-2" playOrder="2"><navLabel><text>Section 1: Family &amp;amp; Friends</text></navLabel><content src="ratw.html#sec1"/></navPoint>
[some stuff omitted ...]
<navPoint id="navpoint-3" playOrder="3"><navLabel><text>Acknowledgements</text></navLabel><content src="ratw.html#acknowledgements"/></navPoint>


Finally, the cover image must be part of the package. I will go into more detail in part 2 about how we created our cover, but please note that this is not a post about graphic design, and I can’t claim any special expertise in that area.

I can say here, though, that the KDP guidelines require an image that is 2560 pixels by 1600 pixels with 350ppi, and be 5 MB or smaller.


The body of the text needs to be written in XHTML (eXtensible Hypertext Markup Language), similar to HTML, which is the language that defines web pages. This is where having your book well-organized comes in: you’ll need to add XHTML tags to delineate chapter titles, TOC items, and paragraphs. Ms. Ramirez did an excellent job of providing examples, so I’ll just replicate them here:

<!doctype html>
<html lang="en">
<meta charset="utf-8" />
<title>Your Book Title</title>
<link type="text/css" href="mobi.css" media="amzn-mobi" rel="Stylesheet"/>
<link rel="stylesheet" href="style.css"  type="text/css" />
<!-- Your book goes here -->
<div id="toc">
Table of Contents <br />
<img src="images/ornament.png" width="75" alt="----------" />
<li><a href="#over">Overture</a></li>
<li><a href="#pro">Prologue</a></li>
<li><a href="#ch1">Chapter 1</a></li>
<li><a href="#ch2">Chapter 2</a></li>
<li><a href="#epi">Epilogue</a></li>
<mbp:pagebreak />
<h2 id="ch2">Chapter Two</h2>

<div class="center"><br><img src="images/ornament.png" width="75" alt="----------"></div>


<p>Some quote</p>

<p>Lorem ipsum dolor sit amet, consectetur ... </p>
<p>Lorem ipsum dolor sit amet, consectetur ... </p>
<p>Lorem ipsum dolor sit amet, consectetur ... </p>
<p>Lorem ipsum dolor sit amet, consectetur ... </p>
<div class="center">* * *</div>
<p>Lorem ipsum dolor sit amet, consectetur ... </p>
<p>Lorem ipsum dolor sit amet, consectetur ... </p>
<p>Lorem ipsum dolor sit amet, consectetur ... </p>
<mbp:pagebreak />

Also, any “special” characters need to be converted into their html code. For example, emdashes (—) are denoted with &mdash;, the character ä is represented with &auml;.

Finally, you need to have a CSS file that identifies how you want to format each element. For example, the below specifies margins for paragraphs and headings; makes all h3 headings centered and italicized, and creates a class called “center” (used in the above examples) that centers text.

p { margin-top: 1em; text-indent: 0em; }

h1 {margin-top: 1em}
h2 {margin: 2em 0 1em; text-align: center; font-size: 2.5em;}
h3 {margin: 0 0 2em; font-weight: normal; text-align:center; font-size: 1.5em; font-style: italic;}

.center { text-align: center; }

If the sight of all this code is intimidating, perhaps the best approach is to download the sample books and modifying those files with your own content.

Building the .mobi files

Once all of the files are prepared, then they can be passed through kindlegen, a program that takes your files and produces a MOBI file, the format used in Kindle devices. If there are any problems with your files, the warnings and errors outputted by kindlegen will help you find them.

Previewing the .mobi files

Once the MOBI file has been generated, there are several ways to see what it looks like. For Windows and Mac platforms, there is a program from Amazon called Kindle Previewer that seems intuitive and easy to use. For Linux as well as Mac and Windows, a program called Calibre can do almost the same thing.

Our approach, however, was a little different because we found that desktop programs don’t accurately reflect how the book looks on an actual reading device. To get your new MOBI file on an actual Kindle or Kindle iOS app, you can email it to your Kindle email address, or you can save it to a cloud drive (we used Dropbox) and open the file on your iOS device. Using this process we were able to ensure the book looked the way we wanted it to on the actual device people would be using to read the book.

Uploading to Amazon

Once the book looks the way you want it, it needs to be uploaded to the Amazon website through Kindle Direct Publishing, for which the process is pretty self-explanatory. Perhaps the most difficult part of this process is deciding what price to put on the book!


Admittedly, many authors won’t have the patience to deal with this computer nerd stuff. While writing at the level of HTML gives the author a great deal of control over the look and feel of the book, it may be too steep a learning curve for some. In that case, I recommend taking a look at Scrivener, an all-in-one writing and publishing software available for a small price.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.