The basics
What is a DjVu file?
A DjVu file holds the pages of a document as images, compressed much harder than a PDF or TIFF of the same scan would usually be. It was designed for putting scanned books, journals, maps and manuals online when connections were slow, and it's still common in digital libraries and collections of out-of-print books and old technical papers.
The trick is that DjVu doesn't treat a page as one picture. It splits a scan into layers: sharp black text in one, photos and paper texture in another, each compressed with a method that suits it. A scanned page of text at 300 dpi often fits in a few tens of kilobytes.
A DjVu file can also carry an invisible text layer (usually from OCR) for searching and copying, an outline of bookmarks, hyperlinks and metadata. What it can't hold is live text in fonts, forms, scripts or signatures: it is a format for page images, not for documents you edit.
Anatomy
What's inside a DjVu file
DjVu uses the IFF chunk format: every piece of data is a chunk with a four-letter name, a 4-byte big-endian length and its data, and FORM chunks hold other chunks. Here is the chunk tree of our three-page sample-document.djvu, read from the file.
offset chunk size contents
0 41 54 26 54 "AT&T": the DjVu magic
4 FORM:DJVM 75,742 the whole document (46 4F 52 4D 00 01 27 DE 44 4A 56 4D)
16 DIRM 89 directory: bundled, 4 files, 3 pages
114 NAVM 100 outline (bookmarks)
222 FORM:DJVU 6,111 page 1, "cover"
234 INFO 10 2481×3508 pixels, 300 dpi
252 INCL 15 → shared_anno.iff
276 Sjbz 4,946 JB2 mask: the text, 1 bit per pixel
5230 ANTz 98 annotation: a hyperlink
5336 TXTz 997 hidden text: every word and its box
6342 FORM:DJVI 124 shared_anno.iff, data shared by all pages
6354 ANTz 112 metadata: title, author, subject
6474 FORM:DJVU 31,619 page 2, "layers"
6486 INFO 10 2481×3508 pixels, 300 dpi
6504 INCL 15 → shared_anno.iff
6528 Sjbz 13,223 JB2 mask: which pixels are text
19760 FG44 764 IW44 foreground: the text colour, 414×585
20532 BG44 5,980 IW44 background, 827×1170 (100 dpi), slices 1–74
26520 BG44 4,138 … slices 75–84
30666 BG44 2,500 … slices 85–90
33174 BG44 4,308 … slices 91–97
37490 TXTz 603 hidden text
38102 FORM:DJVU 37,644 page 3, "photo"
38114 INFO 10 1241×1754 pixels, 150 dpi
38132 INCL 15 → shared_anno.iff
38156 BG44 10,033 IW44 photo, slices 1–74
48198 BG44 10,940 … slices 75–87
59146 BG44 16,600 … slices 88–97- 1
41 54 26 54The magic: AT&T
The first four bytes are the ASCII letters
AT&T, after the lab where the format was made. They're not part of IFF; they mark the file as DjVu before the firstFORM. - 2
FORM:DJVM 75,742The outer form
FORM, then the size of everything after the size field (00 01 27 DE= 75,742, which plus 12 bytes is the file's 75,754), then the form type.DJVMis a multi-page document; a single-page file is aFORM:DJVUon its own, like oursample-bitonal.djvu. - 3
DIRMThe directory
Lists the component files: here three pages and one shared file, with their names and offsets, and says whether the document is bundled (everything in this one file) or indirect (an index pointing to separate page files).
- 4
NAVMThe outline
The bookmarks a viewer shows in its sidebar, compressed with BZZ. We set them with
djvused. - 5
INFO 2481×3508, 300 dpiThe page header
Width and height in pixels (
09 B1and0D B4), the format version, the resolution (300, stored little-endian as2C 01), gamma and rotation. 2481 × 3508 pixels at 300 dpi is an A4 page. - 6
INCL → shared_anno.iffAn include
Pulls in a shared component, here the document's metadata. Shared components also hold JB2 shape dictionaries (
Djbz), so letters that repeat across pages are stored once for the whole book. - 7
SjbzThe mask (JB2)
A 1-bit image of the text and line art at full resolution. JB2 finds marks that look alike, such as every lowercase e, and stores each shape once plus its positions. On page 1 this 4,946-byte chunk is the entire visible page.
- 8
FG44The foreground
The colour of the masked pixels, as a tiny image (here 414 × 585, one sixth of the page). Text colour hardly changes, so it costs only 764 bytes.
- 9
BG44 × 4The background (IW44)
Everything that isn't text: photos, paper, the chart, at a third of the resolution (100 dpi). IW44 is a wavelet codec stored in slices; each extra
BG44chunk refines the picture, so a viewer can show a blurry page from the first chunk and sharpen it as the rest arrives. - 10
TXTzThe hidden text
Every word with its bounding box in page pixels, grouped into lines, compressed with BZZ. Viewers use it for search, selection and copying. In scans it comes from OCR.
- 11
ANTzAnnotations
Hyperlinks (
maparea), highlighted areas, the initial zoom, and metadata such as the title. Ours links the subtitle on page 1 to this page.
Origins
From AT&T Labs to DjVuLibre
- 1996: Yann LeCun starts the DjVu project at AT&T Labs-Research, with Léon Bottou, Patrick Haffner, Paul Howard, Yoshua Bengio and others.
- 1998: the first public tools and free browser plug-ins for Windows and Linux.
- 1999: AT&T publishes version 2.0 of the DjVu Reference Library under an open-source licence.
- 2000: LizardTech acquires the technology. In November it releases the reference library under the GNU GPL.
- 2002:
image/vnd.djvuis registered with IANA, with Léon Bottou as the contact. - Since then: Bottou's cleaned-up version of the code, DjVuLibre, has become the open-source implementation that most viewers use, maintained by the original developers. Its latest release is 3.5.30, from May 2026.
The commercial rights have changed hands since, but the format itself has hardly changed. DjVu's browser plug-ins stopped working when browsers dropped plug-in support, while PDF gained built-in viewers in every browser, so DjVu files now have to be downloaded and opened in a separate app.
Under the hood
The layer model: mask, foreground and background
| Layer | Chunk | Holds | Compression | Typical resolution |
|---|---|---|---|---|
| Mask | Sjbz | Which pixels are text or line art (1 bit per pixel) | JB2, lossless or lossy | Full scan resolution, such as 300 dpi |
| Foreground | FG44 or FGbz | The colour of the masked pixels | IW44, or a small palette | Very low: colour barely changes |
| Background | BG44 | Pictures, paper colour, stains, everything else | IW44 wavelets, lossy and progressive | About a third of the scan, such as 100 dpi |
To draw a page, a viewer paints the background, then paints the foreground colour through the mask. Pages don't need all three layers: a black-and-white page is a mask alone (sample-bitonal.djvu), a photo is a background alone (sample-photo.djvu), and an image with a few flat colours can be a mask with a colour palette (sample-palette.djvu).
- JB2 is DjVu's bitonal codec, a variant of the JBIG2 idea: it collects the shapes on a page, stores each distinct shape once and records where it's used. Shapes can be shared across pages in a
Djbzdictionary. DjVuLibre puts JB2 at about 3 to 10 times better than the fax compression (CCITT Group 4) used in TIFF and PDF scans, and about 20% better than JBIG2. - Lossy JB2 goes further by treating nearly identical shapes as the same one. Most of the time that only removes scanning noise, but it can also replace a character with a similar-looking one from elsewhere on the page. For documents where every digit matters, encode losslessly (the default of
cjb2). - IW44 is a wavelet codec for continuous-tone images, stored in progressive slices. DjVuLibre describes photos as about half the size of a JPEG of the same quality.
- BZZ is a general-purpose compressor, similar to bzip2, for the text layer, annotations and the outline.
Variants
Single-page, bundled and indirect documents
| Kind | Structure | Use |
|---|---|---|
| Single page | One FORM:DJVU | A single scanned page or image |
| Bundled | One file: FORM:DJVM with a directory and every page inside | Downloading and sharing; what you almost always get |
| Indirect | A small index file plus one file per page and per shared component | Serving large books from a web server, so a viewer fetches only the pages being read |
djvmcvt converts between the two: djvmcvt -i book.djvu outdir index.djvu splits a bundled file into an indirect set (our sample became a 206-byte index, three page files and the shared annotation file), and djvmcvt -b index.djvu book.djvu bundles it again. djvm adds, removes and reorders pages.
Related formats
DjVu vs PDF
| DjVu | ||
|---|---|---|
| Made for | Scanned pages and images | Any document: text, vector graphics, fonts and images |
| Text | Hidden text layer over the image | Real text in embedded fonts, or a hidden layer over a scan |
| Scans | Layered by design; usually smaller than an image-only PDF of the same scan | Can be small with JBIG2 and layered (MRC) compression, but often isn't |
| Opens in | A separate viewer | Every browser, phone and computer |
| Forms, scripts, signatures, encryption | None | All supported |
| Standard | Published specification, IANA media type | ISO 32000, plus PDF/A for archiving |
For sharing with people who just want to read, PDF wins on compatibility. For large scanned collections where size and quality matter, DjVu still makes smaller files, which is why archives and scanning communities keep using it.
How to
How to open a DjVu file and convert it to PDF
- Windows: SumatraPDF or DjView. Windows has no built-in DjVu support.
- Mac: DjView (DjVuLibre's viewer). Preview doesn't open DjVu.
- Linux: Okular, Evince (GNOME Document Viewer) and DjView; most distributions package DjVuLibre.
- Phones: document reader apps for Android and iOS that list DjVu support.
- Browsers: not natively. Extensions based on DjVu.js can show DjVu pages in Chrome and Firefox.
To PDF, DjVuLibre's ddjvu renders every page: ddjvu -format=pdf -quality=80 book.djvu book.pdf. It produces image-only pages without the text layer or the bookmarks, and the result is much larger: our 76 KB sample-document.djvu became a 2.7 MB PDF with the default settings and 545 KB with -quality=80. Run OCR on the PDF afterwards (for example with OCRmyPDF) to make it searchable again.
- To images:
ddjvu -format=tiff -page=1 book.djvu page1.tif, or-format=pnmfor one page as PPM/PBM. - Get the text:
djvutxt book.djvuprints the hidden text layer. - PDF to DjVu:
pdf2djvukeeps the text, links and outline: it turned our 190 KBsample-article.pdf(from the TeX page) into a 17 KB DjVu. - Images to DjVu:
cjb2for black-and-white,c44for photos and colour scans,cpaldjvufor images with few colours, thendjvm -cto combine pages anddjvusedto add text, bookmarks and metadata.
Security
Is it safe to open a DjVu file?
DjVu is a passive format: it has no scripts, forms or embedded programs, and its IANA registration notes that its fields only describe how to display the document. The risk is the same as for any image format: a malformed file could trigger a bug in the decoder, and DjVuLibre, which most viewers use, has had memory-safety bugs fixed over the years. Keep your viewer updated.
DjVu has no digital signatures, so nothing in the file proves who made it or that pages weren't replaced. Its hyperlinks can point anywhere, like a link in any document.
Free downloads
Sample DjVu files to download
Free sample DjVu files built with DjVuLibre 3.5.28 from pages and images we rendered ourselves, for testing viewers, converters, upload pipelines and text extraction. Each one decodes cleanly with ddjvu and passes djvudump.
Browsers can't show this kind of file in a page. Download it to open it in the app it belongs to.
What's inside sample-document.djvu
Browsers can't show DjVu, so download the file and open it in a DjVu viewer. Each page demonstrates a different way of encoding a page.
Page 1: bitonal
A typeset text page at 300 dpi, encoded with
cjb2as a JB2 mask only: 4,946 bytes for an A4 page. It includes a line drawing of the three layers.Page 2: three layers
Dark blue text in the mask, its colour in an
FG44foreground, and a photo and a chart in a 100 dpiBG44background, assembled withdjvumake. Zoom in: the text stays crisp while the photo softens.Page 3: a photo page
A full-page synthetic landscape at 150 dpi, IW44 only, in three progressive slices.
Hidden text
Pages 1 and 2 have a text layer with a box for every word, so search, selection and
djvutxtwork.Outline and page titles
Bookmarks for the three pages and page titles (
cover,layers,photo), set withdjvused.Metadata and a link
Title, author and subject in a shared annotation, and a hyperlink over the subtitle on page 1.
All sample DjVu files
Three-page document with text and outline
sample-document.djvu · 74.0 KB (75,754 bytes)
A bundled A4 document: a JB2-only page, a three-layer compound page and an IW44 photo page, with a hidden text layer, bookmarks, page titles, metadata and a hyperlink.
- Testing DjVu viewers: layers, search, outline, links
- Checking converters for what they keep
Single page, bitonal JB2
sample-bitonal.djvu · 7.7 KB (7,933 bytes)
One
FORM:DJVUpage: page 1 of our sample LaTeX article rendered at 300 dpi in black and white and encoded losslessly withcjb2. No text layer, like a scan before OCR.- Testing single-page files
- Testing OCR tools on a clean scan-like page
Colour photo, IW44
sample-photo.djvu · 28.6 KB (29,288 bytes)
A 1600 × 1000 synthetic landscape at 150 dpi, encoded with
c44in three progressive IW44 slices.- Comparing IW44 with JPEG at a similar size
- Testing progressive decoding
Few-colour chart, cpaldjvu
sample-palette.djvu · 3.2 KB (3,254 bytes)
A 900 × 600 bar chart with flat colours, encoded with
cpaldjvuas a JB2 mask, an 8-colourFGbzpalette and a tiny white background.- Testing palette (FGbz) decoding
- Diagrams, maps and charts as DjVu
Ways to test with them
- Viewer support: open
sample-document.djvuand check that all three pages render, the outline lists three bookmarks, a search forwaveletsfinds page 1, and the subtitle on page 1 is a link. - Layer rendering: zoom into page 2. The dark blue text should stay sharp at any zoom while the photo behind it softens.
- Conversion: convert the featured file to PDF with your tool and check what survives: page images, text layer, bookmarks, links.
- File-type detection: all four files start with
AT&TFORM. Three are single pages (DJVUat byte 12) and one is a multi-page document (DJVM).
Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.
Put it online
Have a DjVu file? Give it a link.
Drop a DjVu file on 99helpers and it gets its own web address. Browsers can't display DjVu, so visitors who open the link download the file and read it in a DjVu viewer.
Questions
DjVu files, frequently asked
What is a DjVu file?
A compressed document made of page images, usually scanned books or papers, often with a hidden text layer for searching. It's an alternative to PDF for scans.
How do I open a DjVu file?
With a DjVu viewer: SumatraPDF or DjView on Windows, DjView on a Mac, Okular or Evince on Linux. Web browsers and the built-in viewers of Windows and macOS can't open it.
How do I convert DjVu to PDF?
Use ddjvu -format=pdf book.djvu book.pdf from DjVuLibre, or an app that exports to PDF. The result is usually much larger and loses the text layer, so run OCR on it if you need search.
Why are DjVu files so small?
Each page is split into layers: text as a sharp 1-bit mask with repeated letter shapes stored once (JB2), and pictures as a lower-resolution wavelet image (IW44). Each layer gets the compression and resolution it needs.
Is DjVu better than PDF?
For scanned pages DjVu often makes smaller files at the same quality. PDF opens everywhere and also handles digital text, forms and signatures. For sharing with most people, PDF is the safer choice.
Can I search or copy text in a DjVu file?
Only if it has a hidden text layer, usually added by OCR when the book was scanned. djvutxt file.djvu shows whether there is one.
Is it safe to open a DjVu file?
DjVu can't contain scripts or macros. As with any image format, keep your viewer updated in case a malformed file targets a decoder bug.
How do I pronounce DjVu?
Like the French "déjà vu".
Related formats
Other file types explained
Keep going
Related
Sources
- DjVuLibre: DjVu format and software overview
- DjVuLibre: history and credits
- IANA: image/vnd.djvu media type registration
- The National Archives (UK), PRONOM: DjVu File Format (fmt/255)
Last reviewed 27 October 2026.