
KindleGen is Amazon’s official command-line ebook converter. Though discontinued, it remains essential for professional ebook creation.
What is KindleGen?
KindleGen converts HTML, XHTML, and OPF files into Kindle-compatible MOBI/AZW3 format. It was Amazon’s recommended tool for years and still produces the most standards-compliant output.
Important: Amazon stopped providing KindleGen downloads in 2023. The last version is 2.9. You can still find it archived online or extract it from Kindle Previewer.
Why Still Use KindleGen?
| Reason | Explanation |
|---|---|
| Standards compliance | Produces Amazon’s most compatible MOBI files |
| Precise control | You control every aspect of the output |
| Batch processing | Can script conversions for many books |
| No GUI needed | Perfect for automation and CI/CD |
| Lightweight | 10MB vs 400MB+ for Kindle Previewer |
How to Get KindleGen
Since Amazon removed official downloads:
- Install Kindle Previewer (the newest version)
- Navigate to the installation folder:
- Windows:
C:\Program Files\Kindle Previewer 3\lib\kindlegen\ - macOS:
/Applications/Kindle Previewer 3.app/Contents/MacOS/lib/kindlegen/
- Windows:
- You’ll find the
kindlegenexecutable there
Basic Usage
Command Line
kindlegen mybook.opf
This generates mybook.mobi in the same folder.
Common Options
kindlegen mybook.opf -o output.mobi # Specify output filename
kindlegen mybook.opf -verbose # Detailed output
kindlegen mybook.opf -c1 # Compression level (0-2)
kindlegen mybook.opf -gif # Convert GIFs to PNGs
kindlegen mybook.opf -locale en # Set language
Complete Workflow
Step 1: Prepare Your Files
Create an OPF package file and your HTML content:
mybook/
├── content.opf # Metadata and manifest
├── toc.ncx # Table of contents
├── chapter-01.html # Chapter 1
├── chapter-02.html # Chapter 2
├── styles.css # CSS styles
└── images/
├── cover.jpg
└── image1.jpg
Step 2: Create OPF File
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="BookId">
<metadata>
<dc:title>My Book Title</dc:title>
<dc:creator>Author Name</dc:creator>
<dc:language>en</dc:language>
<dc:identifier id="BookId">978-0-000-00000-0</dc:identifier>
</metadata>
<manifest>
<item id="cover" href="images/cover.jpg" media-type="image/jpeg"/>
<item id="chapter1" href="chapter-01.html" media-type="application/xhtml+xml"/>
<item id="chapter2" href="chapter-02.html" media-type="application/xhtml+xml"/>
<item id="css" href="styles.css" media-type="text/css"/>
<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
</manifest>
<spine toc="ncx">
<itemref id="cover" linear="no"/>
<itemref id="chapter1"/>
<itemref id="chapter2"/>
</spine>
</package>
Step 3: Run KindleGen
kindlegen content.opf -verbose -c1
Step 4: Test the Output
- Open the generated
.mobifile in Kindle Previewer - Check formatting on multiple device simulations
- Verify table of contents links
KindleGen vs Modern Tools
| Feature | KindleGen | Kindle Previewer | Calibre |
|---|---|---|---|
| Format support | HTML → MOBI/AZW | EPUB → KFX | 20+ formats |
| Quality | ★★★★★ | ★★★★ | ★★★★ |
| Ease of use | ★★ (command line) | ★★★★ (GUI) | ★★★★★ (GUI) |
| Automation | ✅ Excellent | ❌ No | ⚠️ Limited |
| Output format | MOBI, AZW3 | KFX | MOBI, AZW3, EPUB |
Pro Tips
- Use
-c1compression — best balance of size and quality - Validate with EpubCheck before running KindleGen
- For KFX output, use Kindle Previewer instead (KindleGen doesn’t support KFX)
- Batch convert with a shell script:
for f in *.opf; do kindlegen "$f" -c1 done - The 64-bit version (extracted from Kindle Previewer) works better on modern systems