Introduction
MOBI is the ebook format of Mobipocket, a French company whose reader ran on Palm,
Windows Mobile and other early handheld devices. Amazon bought Mobipocket in 2005 and
built the first Kindle’s format on it, so older Kindle books use the same structure, often
with the extension .azw and with DRM. The format has been replaced by
AZW3 and newer Kindle formats, and Amazon no longer
accepts MOBI files for sending to a Kindle.
Mobipocket never published a full specification; what is known comes from reverse engineering.
Structure
A MOBI file is a Palm database (PDB),
big-endian. It starts with a 78-byte header holding the book’s short name, dates, the
type BOOK and creator MOBI at offsets 60 and 64, and the
number of records, followed by a list giving the offset of each record.
Record 0 holds a 16-byte PalmDOC header
(the compression method, the text length, the number of text records and the
encryption), then the MOBI header starting with the bytes MOBI, and usually
an EXTH block of metadata such as author,
publisher and cover. The book’s HTML-like
text follows in records of up to 4,096
bytes, compressed with PalmDOC’s simple LZ77 scheme or with HUFF/CDIC Huffman coding,
then index records, images and a few
tagged records.
0PDB header name, dates,BOOKMOBI, record count78 bytes78Record list offset and attributes of each record8 bytes each…Record 0 PalmDOC header, MOBI header, EXTH metadata, full titlevaries…Text records the compressed book text and trailing entriesup to 4,096 bytes each, uncompressed…Index, image and tagged recordsINDX, images,HUFF,FLIS,FCIS, end of filevaries
Not described
Amazon and Mobipocket never published the format. These pages follow the MobileRead wiki, calibre and KindleUnpack, and the parts below are not covered.
Known, not yet covered
- Reference: ORDT and LIGT index tables and the dictionary index tags, which calibre’s reader code handles; they would go on other records.
- Reference: the separate MBP side file (reading position and notes), described on the MobileRead wiki.
- Viewer: there is no MOBI viewer; the file is not recognised, so the explorer shows it as unidentified bytes.
Unknown
- Reference: the DRM block and key derivation (not public).
- Reference: the trailing-entry layout for bit 1 (TBS) and the contents for bit 2 (uncrossable breaks) of the extra data flags, see text records.
- Reference: many MOBI header fields, DATP contents and EXTH types 120, 130, 131, 403, 407, 420, 450–453, 505, 519, 526, 529–530, 533–534, 538–544 and 547; the pages list them as unknown, see EXTH. The date format of EXTH 406 is also unconfirmed, as is the INDX index-type offset (the wiki says 8, calibre 12).
Links
Software
- calibre – free ebook library manager, reader and converter (Windows, macOS, Linux)
- SumatraPDF – small, fast free viewer that reads MOBI (Windows)
- KOReader – free reader for e-ink devices (e-readers, Android, Linux)
Developers
- KindleUnpack – tool that unpacks MOBI and AZW3 files into their parts (Python)