From MobileRead
Jump to: navigation, search

KF8 is Amazons new Kindle Format 8 used on the Kindle Fire. It is also supported by fourth-generation Kindle devices running firmware version 4.1.0 or later, by Kindle for PC and by Kindle Reader for the Mac.


[edit] Overview

KF8 (also called AZW3) is basically a compiled ePub that has been compiled using a Palm database and Amazon's DRM scheme. It is targeting ePub 3 version support but existing ePub can also be used. The latest KindleGen software will create KF8. KF8 replaces MOBI but actually includes both a MOBI database and a KF8 database in the same file for backwards compatibility using older Amazon Kindle readers.

Features include:

  • HTML5 support - An ePub 3 feature.
  • Drop caps - Can be done in ePub 2.1 using CSS
  • CSS3 support - An ePub 3 feature.
  • Kindle Text Pop Up
  • Fixed layouts - but not the same as anyone else is using. See Fixed layout ePub#Kindle KF8
  • Kindle Comic Creator - Kindle Panel View - a variation on Fixed layouts for images. This can be used to convert CBR and CBZ files.
  • Embedded fonts - An ePub feature.
  • SVG - An ePub feature.

[edit] The Format

The internal format has been decoded using kindle unpack. It reveals that the basic format remains as a PDB file similar in structure to MOBI. Generally a KF8 file may contain both a MOBI file at the beginning and the newer KF8 version of ePub later. This of course increased the size of the book file although there is some attempt to share resources such as images between the two objects. Kindle Unpack can be used to separate the two structures by building a traditional MOBI file and a KF8 file without the MOBI part (actually a small dummy structure remains) to make the file smaller. There are flags near the start of the database that can be used to identify the type of file.

In spite of the fact that KF8 is targeted at ePub 3 source it still carries forward some HTML constructions that have been de-standardized for years and left over from MOBI's use. Amazon does publish the HTML statements and CSS3 statements that it will recognize. In addition KF8 has extended the ePub 3 format in incompatible ways to support its fixed layout option.

All Kindle products beginning with the Kindle 3 can support KF8, although the Kindle 3 requires an update to do so. However, the Kindle Apple App does not, it supports AZK instead.

[edit] Compilation

Both KindleGen and the Kindle Previewer program can be used to create KF8 by compiling a source ePub file. An ePub file is a zip file containing several standard human readable files. KF8 compiles this into a binary form by creating an internal structure. When this is done all of the original filenames disappear and any links to these are replaced by direct branches in the final database. Image files are retained as a binary structure with knowledge of the original image structure but file names and metadata are gone. Metadata that MOBI supports is still present in the results.

[edit] General Tips

In addition to the CSS tips in EPUB, the following tips are specific to EPUB source content for Kindle:

  • When building an EPUB for Kindle, always set the cover page's linear to "no" in the EPUB spine.
  • When building an EPUB for Kindle, remove the ISBN or use a different ISBN specific to Kindle. Kindle content does not require an ISBN, but should never have the same ISBN as a published EPUB.

[edit] CSS Tips

  • Kindle on iOS does not always respect line-height when set using stylesheets. To avoid inconsistent positioning of drop caps, always specify this property in the style attribute on the drop cap tag itself.
  • Kindle on some platforms does not respect the height CSS property on blocks containing text. This means that unless you use a custom drop cap font that defines a zero-height descender, you will get blank space below your drop cap on some Kindle readers. You can work around this bug by using two separate boxes—one to draw the glyph, one to space out the correct number of lines of text.
  • Kindle does not respect CSS sizes on the <font> tag. If you have content that needs to show up in a larger size on mobi and KF8, the best way to do this like this:
<span class="mobionly"><font size="8">...</font></span>
<span class="kf8only"><span class="mylargertextclass">...</span></span>
Then use media queries to define the kf8only and mobionly so that they each appear on appropriate platforms. For example:
@media amzn-mobi {
.kf8only {
display: none;
.mobionly {
display: inline;
@media not amzn-mobi {
.kf8only {
display: inline;
.mobionly {
display: none;
  • Kindle does not handle the &#173; entity very well. Use <wbr/> instead.
  • Even though KF8 supports SVG, you must provide non-SVG fallback content for MOBI-based readers. Use the classes shown above to designate the SVG content as kf8-specific and the fallback content as mobi-specific.

Additionally, if you plan to distribute your MOBI/KF8 files through Amazon KDP (the normal distribution path for Kindle books), you may encounter two situations where fonts can get stripped out of your book and/or corrupted:

  • If you a specific font is used for more than some large percentage of your text (the exact percentage is unknown, but perhaps more than half), KDP interprets that to be a main body font. To avoid problems, that font should be specified on the body tag in a stylesheet that is referenced by every HTML file. Additionally, you should avoid using that specific font in other styles. Otherwise, your fonts may be stripped out during processing.
  • If you specify the text-rendering: CSS property, its value must be one of auto, optimizeSpeed, or inherit. If you specify a text-rendering value of geometricPrecision or optimizeLegibility, KDP will strip out every font-family property in your CSS (except in the @font declarations). Additionally, Amazon's online previewer fails to handle these text rendering modes even in SVG; when it is asked to draw in those modes (regardless of font), it renders rectangles where the glyphs should be.
  • The KDP tool massively corrupts SVG containing text if it uses inline styles to set the font size. The problem is that KDP automatically converts all px font sizes to rem units. For normal text, this has no impact on anything. However, in SVG code, because the font size is unrelated to the size of the font used in the HTML body tag, this results in text that is only a couple of pixels tall. If you have SVG that contains text, you must replace all of your font-size: declarations in the CSS with font-size attributes on the enclosing text or tspan tag without the px measurement. For example:
<text style="font-family: Geneva; font-size: 20px; font-weight: bold;">
<text font-size="20" style="font-family: Geneva; font-weight: bold;">

[edit] For more information

Personal tools

MobileRead Networks