Friday, October 22, 2010

Step-by-by step Kindle ebook HTML formatting instructions

**************************************
UPDATE!!! (Jan 6, 2010)

I have just published these instructions in a new Kindle eBook:  Format Your eBook for Kindle in One Hour - A Step-by-Step Guide. It's only $2.99!! I've updated the instructions to be easier and hopefully quicker. Plus, it's only $2.99! If you found these instructions helpful, please consider buying the ebook to help support this blog. Thanks!
**************************************
Some other aspiring Kindle authors have asked about formatting their books for Kindle. They’ve wondered whether they should pay a professional service to do it, or do it themselves. They lamented that Amazon’s conversion tool doesn’t do exactly what they want – such as extra line breaks, page breaks, starting chapters further down the page, and so on.
In this post I will give you step-by-step instructions on how to format your Kindle book.
For anyone with HTML coding experience, this is really easy. For those of you without HTML coding experience, I provide my own Kindle ebook HTML template file, which you can start from. You just need to replace some stuff in it.
I don’t do anything fancy in these instructions. No additional images, no cross-linking other than the Table of Contents, no enhanced content. If this post is popular and I get many requests, I may provide similar instructions for other, more complicated formatting.
It took me about an hour to manually format my ebook into a Kindle format.
I am using my first ebook, Dead Dwarves, Dirty Deeds, as the basis for these instructions. If you want your ebook to be formatted simply and cleanly like my ebook, then you can follow these steps.
It might be helpful if you buy the Dead Dwarves, Dirty Deeds ebook and review it while you are reading these instructions. It is available on Amazon for $0.99. It is NOT required to use these instructions.
(But, if these instructions are helpful to you, you can thank me by buying the ebook.)
Since most people probably have Word, I’ll explain how to format your ebook using Word 2007 and a simple text editor (like Notepad). You can also use more advanced text editors, such as Microsoft Expression Web 2.
And, off we go…
  1. Create a new folder on your computer, such as YourBookTitle.
  2. Save your book file in the YourBookTitle folder.
  3. Save your cover art file in YourBookTitle folder. Remember to comply with Amazon guidelines on your cover art.
  4. Save the following HTML file to the YourBookTitle folder: YourBookTitle.html. To save this file, right-click on the link and then click Save Target As. This will open the Save As dialog box and you can save the file.
  5. Rename the YourBookTitle.html file to whatever the title of your book is, such as DeadDwarvesDirtyDeeds.html. I will continue to refer to this file as YourBookTitle.html, though, so you don't get confused.
  6. Open the YourBookTitle.html file in Notepad or some other text editor or HTML code editor.
  7. The template file has all the formatting code already coded into it. You only need to replace some temporary placeholder text with the specifics for your ebook. For each item in the following table, locate the Placeholder text with the appropriate text for your ebook.
    Find this placeholder text in the HTML fileAnd replace it with this
    YourBookTitleThe title of your book, such as Dead Dwarves Dirty Deeds.
    This appears 2 times in the template file.
    YourCoverThe filename of your cover art, such as Deeds. You might also need to change the format extension from .jpg to whatever format you are using.
    YourNameYour name, the author of the book, such as Derek J. Canyon
    This appears 3 times in the template file.
    YourWebSiteYour website URL, such as www.derekjcanyon.com
    This appears 2 times in the template file.
    YourCoverArtistWebsiteThe website of your cover artist, such as www.coverartist.com
    This appears 2 times in the template file.
    YourEditorThe name of your editor, such as Joel Palmer
    YourEditorEmailYour editor’s email address, such as editor@editor.com
    Chapter001The code identifier for your chapters. Change the number for each chapter.
  8. Save the HTML file.
  9. If you don’t want to have a Table of Contents, delete everything between the START_TABLE_OF_CONTENTS and END_TABLE_OF_CONTENTS lines.
  10. If you DO want a Table of Contents, you’ll need to add entries for each of your chapters. I’ve only included entries for the first three chapters. For each additional chapter, replicate the existing chapter code lines and change the chapter numbers. Such as:
    <p align="center"><a href="#Chapter004">Chapter 4</a></p>
    <p align="center"><a href="#Chapter005">Chapter 5</a></p>
    <p align="center"><a href="#Chapter006">Chapter 6</a></p>
    And so on...
  11. If you want to change the text that shows up for each chapter in the Table of Contents, replace the “Chapter 4” with your new text, such as:
    Old: <p align="center"><a href="#Chapter004">Chapter 4</a></p>
    New: <p align="center"><a href="#Chapter004">A Short Cut to Mushrooms</a></p>
  12. If you do change your chapter titles in the Table of Contents, remember to do the same at the beginning of each chapter of the story, such as:
    Old: <h2>Chapter 4</h2>
    New: <h2>A Short Cut to Mushrooms</h2>
  13. Save the HTML file.
  14. Open your book in Word.
  15. Remove the Word headers and footers.
  16. Delete the cover page, title page, copyright page, and all other pages that are not actual pages of the story. You need to start with a clean file of just paragraphs and chapter headings.
  17. Click Replace.
  18. In the Find and Replace dialog box, in the Find What box, type the following: ^p
  19. In the Replace with box, type the following: </p>^p<p>
  20. Click Replace All. This will add the required HTML tags around your Word paragraphs.
  21. Notice that the first paragraph does not have a starting <p> tag. You must type that in now.
  22. Each paragraph must have a <p> at the beginning and a </p> at the end. Go through your story now and make sure this is the case.
  23. If you had blank lines in your story these will now show up as <p></p>. To clean up your HTML, you can replace <p></p> with <br />, if you want. The <br /> tag adds one line break, so if you want an empty space between two paragraphs, you’ll need to add two line breaks: <br /><br />
  24. Check the very last line of your story. There is probably a lonely <p> tag there at the end. Delete it.
  25. If you have any chapter headings, you’ll need to change each of your chapter titles from <p>Chapter title</p> to be the same as the content between the START_CHAPTER_1_HEADING line and the END_CHAPTER_1_HEADING line.  Of course, you'll have to change the relevant parts for each chapter.
  26. Copy everything in the book Word file (you can use Ctrl-A and then Ctrl-C).
  27. Go to the HTML file, put the cursor after the <!-- PASTE YOUR STORY CONTENT AFTER THIS LINE--> line, and then press Ctrl-V on your keyboard to paste your book content into the HTML file.
  28. Save the HTML file.
  29. You are now done formatting your book for Kindle.
  30. However, now you have to compress it into a zip file. This is pretty easy.
  31. In Windows Explorer, select the HTML file and the cover art file.
  32. Right-click on the HTML file, point to Send to, and then click Compressed (zipped) folder.
  33. Your book is ready to be submitted on your Amazon Digital Text Platform Bookshelf.
If you have any questions, use the comments below.

24 comments:

  1. Good Luck!
    Ok, off post for the html, but good to hear the first book is out and the next book is to the editor.

    I've reviewed your sales numbers, ranking, and comments and I have one discrepancy.

    Amazon has 60% to 80% of the market (I estimate 76%.) The ebook market is now $40 million per month. Summing up Novelrank's sales do not seem to be anywhere close to $24million to $32million (Amazon's share of the ebook market.)

    JA Konrath is claiming > 1,000 sales in 2 days while Novelrank shows 58 sales. It has been noted that Amazon tries to obscure their sales... So I'd be curious to know your October sales vs. Novelrank's estimate. I suspect there will be a discrepancy. Hopefully with your sales doing much better. :)

    Good luck and sorry to combine a bunch of your threads into an OT post.

    Neil

    ReplyDelete
  2. Neil, Thanks! Yes, the NovelRank book sales are not accurate at all. My sales are still very low. I've sold 12 copies in October, and NovelRank says I've sold 7. I've read that the discrepancy can be even worse for higher volumes. I'll be posting my full sales numbers for the month after Halloween.

    ReplyDelete
  3. What an awesome walkthrough! Next time I read someone who's confused about how to do this, I know where to send them. Well done!

    ReplyDelete
  4. Oops! There was a typo in the html file. The TOC should say <h2>Table of Contents</h2>.

    I've fixed it, but if you downloaded the file earlier, be sure to fix this typo.

    ReplyDelete
  5. This is very helpful information. I've always wanted to format my Kindle ebook. your blog really helped me a lot doing it. I really appreciate your post.

    ReplyDelete
  6. I'm trying to download the html as per the amazon instructions but the little box gives me no way to save the content file! Am I missing something?

    ReplyDelete
  7. Michael, I have updated that step with instructions on how to download the HTML file. You have to right-click the link and selected Save Target As. Thanks for pointing out the omission!

    ReplyDelete
  8. Derek. Thanks for directing me to this post. Very helpful coolkayaker1

    ReplyDelete
  9. Derek, I'm impressed, but have a few queries percolating. The first 2 that jump to the forebrain is how to do actual page size formatting, including the maximum size & margin specs; also, why is MS Word required and what is an unfiltered HTM/HTML format? Is it only possible to do it with MS Word, not other high quality wordprocessors that write clean MS .doc format? Thanks for your noble generosity. If my remaining confusions evaporate [with your help], I'll gladly buy your guidebook for $0.99

    ReplyDelete
  10. Derek,

    Does Amazon convert this properly with no html tags at all between paragraphs or sections within chapters?

    ReplyDelete
  11. geercom, Yes.

    I had no problems with the conversion using this system. You can see the results with my two fiction ebooks (both now at 99 cents):
    Dead Dwarves, Dirty Deeds and Dead Dwarves Don't Dance.

    ReplyDelete
  12. Your ebook has been a life saver. I was about to give up on Kindle because nothing worked. So, this is a big thank you from me.

    Just a little heads up: Amazon has the ebook at $2.99, which I was happy to pay. But people seeing $0.99 here and then $2.99 on Amazon could think it's a trick, and that could make you lose sales. Of course this could be another case of Amazon not allowing certain prices outside of America.

    ReplyDelete
  13. Daibhin, thanks! I forgot to change the price here when I raised it.

    ReplyDelete
  14. Hi,

    I'm back with a problem.

    In the original file I have two maps, and an image, can you tell me how to add them using html code?

    Everything else has worked perfectly following the method in your ebook, but I don't want to lose the images.

    Hope you can help.

    ReplyDelete
  15. Daibhin, adding an image is relatively easy. First make sure it complies with Kindle's image size requirements. Then, find the cover art code line in the HTML file. Paste that where you want your image to appear, but replace the filename with your new image file name. That should be all, let me know if it doesn't work.

    ReplyDelete
  16. Me again.

    I uploaded the file to Kindle, but when I opened the preview the whole thing had all the html coding showing.

    HELP!

    ReplyDelete
  17. Daibhin, send me an email with the code that you pasted into the file. derek@derekjcanyon.com

    ReplyDelete
  18. Hi Derek,

    It's done. The first download had a glitch, I have no idea what happened there. I downloaded it again and everything has worked fine this time, except that in the preview I don't see indents at the beginning of each paragraph. I don't care, it's better than any other upload and maybe in the actual kindle it works the way it's meant to. Ou, and the images appear :)

    Thank you so much for the offer to email you the code.

    For a while there I was feeling super dumb ;)

    Liz

    ReplyDelete
  19. Remember you can use a kindle emulator to try out your book

    ReplyDelete
  20. I used your template around March 2011 and it worked perfectly. Having revised my book and uploaded a new zip, I find there are no paragraph indents, as Daibhin remarks. I have checked my html file in wordpad very carefully, so it may be that Amazon has changed its program somehow, and your template needs revising?

    ReplyDelete
  21. Anon, Amazon did change their program.

    If you download the template file again, you'll notice the following change near the beginning:

    text-indent:20;
    margin-top:8;

    Make sure your file says this.

    ReplyDelete
  22. Thanks for that, and thanks for the brilliant webpage. i downloaded the template again but it still seems the same, so i have changed my file as you state in your comment.

    ReplyDelete
  23. You might have to clear your browser cache to get the new template.

    Let me know if you have any more problems!

    ReplyDelete
  24. Hi Derek,

    I'm using your template but I'm having problems with the Table of contents. Following your instructions I can create the table and it works fine but the kindle doesn't seem to know that there is a Table of Contents because there is no "table of contents" option in the "Go to" menu.
    Do you know how to fix this?

    Thanks in advance.
    Pepe.

    ReplyDelete