How to Format a Book for the Kindle

So you've got a great idea for a Kindle book but can't make heads or tails of the tutorials that seem to assume you know html and all you know is a few tags you use in your blog? Hopefully this tutorial will help. It will attempt to explain start to finish for the basic html document including things I wish I knew before Teaching My Daughter to Bake Bread
First off, you'll need to set up an account on Amazon's Digital Text Platform site. There are tutorials there for how to upload your books, cover art, and set up your account for payments.




I decided for this project to put together a very short "book" of recipes my teenage daughter really likes with photos and some illustrations.

Introduction to Kindle coding
Photo editing for Kindle books will open in a new window.
Beginning of the book, cover art, copyright information
Setting up a Table of Contents
Creating chapters
Closing tags and uploading


Introduction to Kindle Coding


So you have an idea or maybe an idea and a manuscript. Formatting a book for the Kindle2 is mostly just very simple html. It has some restrictions like managing indentations is hard on a Kindle especially since users can change their font sizes so it's not really an appropriate format at this point for some sorts of poetry. The other obvious restriction is the e-ink technology which is very readable and easy on the eyes but only allows greytones so color illustrations don't work well in that format.
The text shown in red is the text you replace with your file names and other specific information.

There are some very important Kindle specific codes.
Kindle Code What It Does
<mbp:pagebreak/>Forces a page break. Used at the start of new chapters
<a name="start">The beginning of the book with the author information and dedication if you want to do one.
<a name="TOC">A Kindle book will automatically open to the table of contents with this tag.

A lot of html tags work well for Kindles but tables don't really, and for headings you'll want to use heading (<h#>) tags for sizing things. In these sorts of tags, the bigger the number, the smaller the font and they work up to <h5>. Close each tag with </h#>. More on that in setting up chapters.

Back to Top


Beginning of the book


Decide if you want a cover image. How to create images that will work for the Kindle2 is covered in
photo editing. Now you're ready to write the first piece of coding to start your book. You could use an html editor, but html editors create a lot of code that's not necessary which makes the file larger than it needs to be. I use a text editor and write it that way and hopefully using this tutorial you'll be able to do the same thing. So get all your Kindle safe images into one folder and name the folder so you'll remember it. You'll save your html file in the same folder. The first thing you need to do with any html page is start the html with <html>. The next line will be the head section which isn't visible in the book but creates the title that's shown on the top of the Kindle screen, to begin the head, use the code <head>.
To create the title use the code <title>Your Title</title>. The first piece of code shows where your title is, the second piece closes it and shows where it ends. Save your file as booktitle.html. Because it's an html file, you'll be able to check in a browser window how it looks and if it works. The Kindle specific code shouldn't really affect how it looks, it will just be invisible code. Now close the header tag with </head>..
What it looks like so far.

<html>
<head>
<title>Your Title</title>
</head>

Each new line in a Kindle book starts with a paragraph tag and when you finish the paragraph, line or image you need to close the tag. The paragraph tag is <p>. To end it use </p> You'll start the body of the book with <body>. Now it's time to start the contents of your book! The first thing you'll want to do is put in your cover image if you are using on in the book. For that you use an image tag with the name of the cover image in it starting and ending with the paragraph tag. <p><img src="covername.jpg"></p>.
Then you add in the Kindle specific start code, <p><a name="start">.The code is used for targets in html files and you'll be using the same sort of code to set up your chapters. Use a heading tag to increase the size of your title. <h2>Your Title</h2> works well. Close off the target tag and paragraph tag. </a> </p>
After that, you want your copyright and publication information which will look something like
<p>Content copyright Your Name. All rights reserved</p>
<p>Published in the your country</p>
<p>First Publishing Date Month, year</p>
with the month spelled out and the year as numbers.
If you want to do a dedication, this a good place for it. Force a page break so it's on it's own page.<mbp:pagebreak/> <p>Dedication</p>

Now you want to force a page break so your text doesn't start right under this. <mbp:pagebreak/>
What it looks like so far.

<html>
<head>
<title>Your Title</title>
</head>
<body>
<p><img src="covername.jpg"></p>
<a name="start">
<h2>Your Title</h2></a> </p>
<p>Content copyright Your Name. All rights reserved</p>
<p>Published in the your country</p>
<p>First Publishing Date Month, year</p>
<mbp:pagebreak/>
<p>Dedication</p>
<mbp:pagebreak/>

Back to Top


Setting up a Table of Contents

You'll start the table of contents with a code to let the Kindle know this is where to start reading. Start your table of contents with <p><a name="TOC"><h3>Table of Contents</h3></a></p>. Experiment with h sizes. I like the way h3 looks for a TOC.
Now you start listing your chapters but you'll need target names for them. The start and toc tags are examples of targets and each chapter will have a target at the beginning and the names of them in your table of contents will have the code to go to the targets. You'll use hyperlink tags which are set up to go straight to a target in the document. So each chapter title is on it's own line with it's own target the hyperlink points to. Use header tags again to size the chapter names. The format for that is <p><a href="#target"><h4>Chapter name</h4></a></p>. The links to each chapter will be set up that way. After you finish that up, use another page break tag.
What your table of contents code should look like


<p><a name="TOC"><h3>Table of Contents</h3></a></p>
<p><a href="#chap1"><h4>Chapter 1</h4></a></p>
<p><a href="#chap2"><h4>Chapter 2</h4></a></p>
<p><a href="#chap3"><h4>Chapter 3</h4></a></p>
<mbp:pagebreak/>

Back to Top


Creating Chapters

To create your content there are a few things to remember. Page breaks will end a chapter and start the next one on the next page. A target at the beginning of each chapter will give you a link you can select from the table of contents to go straight to that chapter. If you want to put an image in it, you'll use the image tag.
To create a target for your chapter, you'll use this format <p><a name="target"></a>. Notice that unlike the hyperlinks, the target names don't start with a #. Next you may want to put in a name for your chapter. Use the heading tags to make it a bit larger than the rest of the text if you'd like. So a chapters code might look like this.


<p><a name="chap1"></a><h4>Chapter 1</h4></p>
<p> Random text and lots of it, and maybe a picture to illustrate.</p>
<p><img src="picture.gif"></p>
<p> More random text until the end of the chapter.</p>
<mbp:pagebreak/>

Back to Top


Closing tags and uploading

So now you've got all your chapters done and your book is very nearly finished. The final tags on an html document are the end of the body and the end of the html. </body>, hit the return and put in the end of the html </html>.
Now you'll want to zip up the html and the image files all together, there are a lot of good free zip utilities out there if you don't have one. Go to the DTP site. Sign into your account and it will ask for information about what kind of book it is, what's the title, if you want digital rights management enabled and all that, then you'll upload the whole zip file and you'll be offered an option to preview after it converts it. Then you'll be able to set the price and in a couple days it will be all published and available for sale in the Kindle book section of Amazon. They pay you a percentage of the cover price. All the information about uploading, how to get paid and all that is on the DTP site.
For a lot more information about how to format books for the Kindle check out Joshua Tallant's Kindle Formatting. He explains how to use CSS code and has just tons of information for fancier editing.

Back to Top


If you like what this page has to offer, please consider supporting it. Or you can make an instant Paypal donation.