File types · Explainer

The DjVu file (.djvu, .djv)

A DjVu file is a compressed document made of page images, built for scanned books and papers, often with a hidden text layer so you can search it. This guide explains what's inside one, how its layers work, how to open and convert it, and has free sample DjVu files to download for testing.

At a glance

Full name
DjVu (pronounced like the French déjà vu)
Extensions
.djvu, .djv
MIME type
image/vnd.djvu (registered with IANA in 2002); image/x-djvu is also seen
Kind
Binary, raster: page images in layers, with optional hidden text, links and an outline
Compression
JB2 for black-and-white (lossless or lossy), IW44 wavelets for colour (lossy), BZZ for text and metadata
Created by
AT&T Labs (Yann LeCun, Léon Bottou and colleagues); the open-source reference is DjVuLibre
First released
1998, after work at AT&T Labs that began in 1996
Opens with
DjView, SumatraPDF (Windows), Okular and Evince (Linux); not web browsers
Typical size
About 5–30 KB per black-and-white page and 30–100 KB per colour page scanned at 300 dpi, according to DjVuLibre
Magic number
41 54 26 54 46 4F 52 4D (AT&TFORM), then DJVU (one page) or DJVM (several) at byte 12

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.

sample-document.djvu (chunk tree)
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. 141 54 26 54

    The 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 first FORM.

  2. 2FORM:DJVM 75,742

    The 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. DJVM is a multi-page document; a single-page file is a FORM:DJVU on its own, like our sample-bitonal.djvu.

  3. 3DIRM

    The 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. 4NAVM

    The outline

    The bookmarks a viewer shows in its sidebar, compressed with BZZ. We set them with djvused.

  5. 5INFO 2481×3508, 300 dpi

    The page header

    Width and height in pixels (09 B1 and 0D B4), the format version, the resolution (300, stored little-endian as 2C 01), gamma and rotation. 2481 × 3508 pixels at 300 dpi is an A4 page.

  6. 6INCL → shared_anno.iff

    An 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. 7Sjbz

    The 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. 8FG44

    The 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. 9BG44 × 4

    The 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 BG44 chunk refines the picture, so a viewer can show a blurry page from the first chunk and sharpen it as the rest arrives.

  10. 10TXTz

    The 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. 11ANTz

    Annotations

    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.djvu is 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

LayerChunkHoldsCompressionTypical resolution
MaskSjbzWhich pixels are text or line art (1 bit per pixel)JB2, lossless or lossyFull scan resolution, such as 300 dpi
ForegroundFG44 or FGbzThe colour of the masked pixelsIW44, or a small paletteVery low: colour barely changes
BackgroundBG44Pictures, paper colour, stains, everything elseIW44 wavelets, lossy and progressiveAbout 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 Djbz dictionary. 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

KindStructureUse
Single pageOne FORM:DJVUA single scanned page or image
BundledOne file: FORM:DJVM with a directory and every page insideDownloading and sharing; what you almost always get
IndirectA small index file plus one file per page and per shared componentServing 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

DjVuPDF
Made forScanned pages and imagesAny document: text, vector graphics, fonts and images
TextHidden text layer over the imageReal text in embedded fonts, or a hidden layer over a scan
ScansLayered by design; usually smaller than an image-only PDF of the same scanCan be small with JBIG2 and layered (MRC) compression, but often isn't
Opens inA separate viewerEvery browser, phone and computer
Forms, scripts, signatures, encryptionNoneAll supported
StandardPublished specification, IANA media typeISO 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=pnm for one page as PPM/PBM.
  • Get the text: djvutxt book.djvu prints the hidden text layer.
  • PDF to DjVu: pdf2djvu keeps the text, links and outline: it turned our 190 KB sample-article.pdf (from the TeX page) into a 17 KB DjVu.
  • Images to DjVu: cjb2 for black-and-white, c44 for photos and colour scans, cpaldjvu for images with few colours, then djvm -c to combine pages and djvused to 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.

sample-document.djvu · 74.0 KBDownload

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.

  1. Page 1: bitonal

    A typeset text page at 300 dpi, encoded with cjb2 as a JB2 mask only: 4,946 bytes for an A4 page. It includes a line drawing of the three layers.

  2. Page 2: three layers

    Dark blue text in the mask, its colour in an FG44 foreground, and a photo and a chart in a 100 dpi BG44 background, assembled with djvumake. Zoom in: the text stays crisp while the photo softens.

  3. Page 3: a photo page

    A full-page synthetic landscape at 150 dpi, IW44 only, in three progressive slices.

  4. Hidden text

    Pages 1 and 2 have a text layer with a box for every word, so search, selection and djvutxt work.

  5. Outline and page titles

    Bookmarks for the three pages and page titles (cover, layers, photo), set with djvused.

  6. 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:DJVU page: page 1 of our sample LaTeX article rendered at 300 dpi in black and white and encoded losslessly with cjb2. 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 c44 in 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 cpaldjvu as a JB2 mask, an 8-colour FGbz palette 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.djvu and check that all three pages render, the outline lists three bookmarks, a search for wavelets finds 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 (DJVU at 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

Last reviewed 27 October 2026.