kindleAmazon’s Kindle, both the standalone version and the iPhone app, make a compelling case for self-published books. The service is quick, free and (mostly) painless. And if you format your books properly, they will look every bit as good as those from traditional publishers.

When I was preparing my short story The Variant for the Kindle, I found a lot of confusing and contradictory information about how to do the formatting — much of it on the official help site. So I’m writing up this quick guide aimed at somebody with roughly my level of coding or design experience.

If you feel comfortable hand-coding a site, you can get a book formatted in 30 minutes or less.

You’ll want to download the source file for The Variant to follow along. If you compare it with the published version as it appears in the Kindle store, you’ll see how it matches up.

(If any of this is over your head, there are several more comprehensive tutorials out there, including Joshua Tallent’s Kindle Formatting.)

So here we go.

1. It’s just a stripped-down HTML document

It’s not XML or anything fancy. Pretend it’s 1995 and you're coding for Netscape Navigator. Think basic.

The Kindle converter will try its best to process a .doc or .pdf, but the results will be always worse than basic HTML. So don't bother. Just give it what it wants. Give it HTML.

Every paragraph is wrapped in standard <p>…</p> tags. I used TextMate's "Wrap Each Selected Line in Open/Close Tag" command, but you may have your own favorite technique.

To force a page break, use <mbp:pagebreak />. There's another way to do it using a style="page-break-before: always;" within an enclosing paragraph tag, but <mbp:pagebreak /> is easier to find when looking through your file.

Links and anchors work just as you'd suspect, which makes it quick to build a table of contents, or link back to a webpage.

In addition, you’ll want to place a special anchor where the text starts: <a name="start"/>. When the book is first opened, it will jump to this spot. This lets you skip over title pages.

2. The less you try to format, the happier you’ll be

You’ll embed a little CSS style sheet in your HTML, but it’s incredibly basic. Use the default typeface. Stick to <em> and <strong>. Let the Kindle do what it wants to do, and you’ll get good results.

The Kindle will default to indenting each paragraph, which looks okay. It will also justify text, which is dandy or unspeakable depending on your preferences. After reading a few dozen books on my Kindle, I’ve come to expect right justification. So will most Kindle readers. But it’s your call. You can override it by setting the text-align property for your paragraph tags.

In books, you often leave a blank line or two between sections of text. It’s best if that’s not indented, so add a CSS rule to do that. Following Joshua Tallent’s lead, I used a CSS class .noind with text indent set to 0, and applied that just to the necessary <p>'s.

I wanted the text to start a little lower on the first page, so I added <p height="40">&nbsp;</p>. I also put the first sentence in caps.

3. Encode your entities (except for your actual tags)

To be safe, it’s a good idea to convert curly quotes, em dashes and other niceties to their HTML equivalents. Again, TextMate makes this simple: under “Entities,” choose “Convert Character to Entities Excl. Tags.”

That’s it. You’re done with your file. Metadata and other details will be added in through the web interface.

4. If you have a Kindle, mail this file to yourself

When you set up a real (non-iPhone) Kindle, you’re given the option to set up an email address like Anything you send to this address (from a pre-approved address) will get wirelessly schlepped to your Kindle.

So email yourself the HTML file. Check it out on your Kindle to see how it looks. If there's anything you want to change, do it now.

5. Log into the DTP publisher

Amazon’s Digital Text Platform is the home base for your Kindle project. You can log in with your standard Amazon ID. You’ll need to establish details about payment, including bank and ID number in the My Account tab.

You’ll be adding your book in the My Shelf tab. Click “Add a New Item.”

First, you’ll enter product details. You can skip ISBN and any other field that doesn’t apply. (Such as Series Title.)

It’s on this screen that you’ll upload an image for the cover. When preparing your artwork, keep in mind how small it may end up being scaled: down to 35 pixels wide in some lists. For The Variant, I ended up fattening my title type so that it could still be readable at such a tiny size. (I suspect “real” publishers get to submit their artwork in several sizes for optimized display.)

Once you have your product details entered, you’ll upload your HTML file. It’s surprisingly fast. You’ll see a Flash-based preview of your book, which is almost useless except for checking gross errors like missing page breaks. Use it only if you have no access to a real Kindle.

The last tab lets you set a price. Then it’s time to publish.

6. You’re done

Based on the forums, I worried there might be App Store-like delay and approval process before the book would go live. But no. Within an hour, I could navigate to the page on Amazon. Another 45 minutes, and I could download it on my Kindle, just like any other book.

In fact, by the next day, The Variant was the #20 title on Kindle. It’s stayed in the top 100 since.

One thing to remember: the Kindle is U.S.-only. Even with the iPhone app, international users can’t buy your book through Amazon. That’s why it’s important to offer alternatives. For The Variant, I included both .pdf and ePub formats, available through the book’s promotional page.

Amazon makes it surprisingly easy to publish your book, even if the instructions aren’t always straightforward. Anyone with hand-coding chops can get a good-looking book online.