Open book format · FAB2 · Fabylon
.fab
a book format that keeps the page
Every .fab file on earth begins with the same sixteen bytes: FABYLON_BOOK_02! What follows is not a website in an archive. It is the book itself — pages, lines, indents, geometry and assets stored as book data, with the line breaks already decided by an algorithm that weighs the whole paragraph instead of the next word.
Not EPUB with a different extension
A literary book is not a collection of HTML files. It is an ordered typographic object: text, pagination, reading order, geometry, images and metadata that together form a structure. EPUB stays close to an older idea — web documents inside a ZIP archive, with the layout reconstructed by a browser-like engine. That is broadly compatible, and it is indirect.
.fab stores book primitives as first-class data. EPUB says here are web documents that can together form a book. .fab says here is the book, as a book.
The line breaks are already decided
Your e-reader fills each line until the next word will not fit, then breaks. That is first-fit, the method typesetting abandoned after Knuth and Plass published optimal line breaking in 1981. Every browser does it, and every EPUB reader is a browser.
A .fab carries lines that were broken by minimising the badness of the whole paragraph. The gain is not cosmetic and it is not uniform: on short paragraphs there is little in it, and on long ones the difference is large. On a 320-word paragraph the worst non-final line goes from 20.9% to 15.1% residual space — a 28.0% reduction — measured on this engine on 2026-08-17 with a command you can run yourself.
Three further instruments run in the same pass: glyph stretching on loose justified lines, optical margins derived from each embedded font's own ink geometry, and kerning from the engine's own GPOS reader. The mathematics page gives the formulas; the benchmarks page gives the numbers and the method.
What is actually in the file
A fixed 16-byte magic string, two little-endian lengths, a zstd-compressed JSON manifest, and a chunk arena holding one compressed page block plus the assets. The first page is duplicated inside the manifest, so opening a book and showing page one never requires decompressing the whole page block.
16 bytes magic: FABYLON_BOOK_02! 4 bytes compressed manifest length, little-endian uint32 4 bytes raw manifest length, little-endian uint32 N bytes zstd-compressed compact JSON manifest M bytes chunk arena
That is the whole container at the top level. The specification page documents the manifest fields, the page records, the asset table, the legacy magic string and how to identify a .fab reliably.
Honest about the limits
An early synthetic fixture showed .fab at 6% of the equivalent EPUB. That number is not representative — the fixture was an artificially repetitive document. On real books the ratio is about 0.56, roughly 1.8× smaller than EPUB, and it varies per title between 0.40 and 0.64. Heavily illustrated books can be larger.
So size is not the strongest claim. The strongest claims are decided typography, a first page that does not require the whole book, random access to any page, and per-chunk integrity. EPUB remains a mature interchange standard and PDF remains print-fixed. .fab is for the case where fidelity of form matters more than general web compatibility.
One thing this format does not do, despite an earlier description elsewhere: it does not embed PDF or EPUB fallback copies inside the container. A .fab holds the manifest, the page block and the assets. The fallbacks are published beside it, as the downloads below.
Read the paper
The technical article “.fab as a mathematical book format”, typeset with Fabylon Bookmaker, in five languages. Each is available as PDF, as EPUB, and as .fab — the format it describes. Open .fab files with the free Fabylon Reader.