CBZ (Comic Book ZIP archive)
| Full name | Comic Book ZIP archive |
|---|---|
| Extensions | .cbz |
| MIME type | application/vnd.comicbook+zip (registered with IANA) |
| Type | container (ZIP archive of images) |
| Starts with | 50 4B 03 04 (PK\x03\x04, a ZIP local file header) |
| Specification | no formal spec; container is ZIP (PKWARE APPNOTE), metadata is ComicInfo.xml |
| Maintained by | no owner (de facto standard); ComicInfo schema by the Anansi Project |
| License | open, royalty-free |
A CBZ file is a regular ZIP archive that holds the pages of a comic book as image files, usually JPEG or PNG. A reader opens the archive, sorts the image names and shows them in that order. Rename book.cbz to book.zip and any ZIP tool opens it.
CBZ is the most common and best-supported comic book format: every comic reader, comic server (Komga, Kavita) and e-book manager reads it, and ZIP libraries exist in every language. An optional ComicInfo.xml file in the archive carries metadata: series, issue number, credits, reading direction and page types.
When to use CBZ#
- Use to distribute and archive comics, manga and scanned graphic novels: every reader supports it.
- Use instead of CBR when you create files: ZIP is open and can be written by any tool; RAR can only be created with WinRAR.
- Use when readers need random access: ZIP has a central directory, so a reader can jump to page 200 without decompressing pages 1-199.
- Avoid re-compressing pages: store JPEG/PNG/WebP files without compression (method 0) or with fast Deflate. The images are already compressed; Deflate saves 1-3%.
- Avoid when you need reflowable text or real vector art: use EPUB (fixed-layout) or PDF.
File structure#
A CBZ is a ZIP archive. Each page is one entry; the ZIP central directory at the end of the file lists every entry with its offset, so a reader can open any page directly.
Batman 001.cbz
├── ComicInfo.xml optional metadata
├── 000.jpg cover
├── 001.jpg
├── 002.jpg
├── ...
└── 024.jpg
50 4B 03 04 local file header signature "PK\3\4"
14 00 version needed: 2.0
00 00 flags
00 00 compression method: 0 (stored)
... time, date, CRC-32, sizes, name length
30 30 30 2E 6A 70 67 file name "000.jpg"
FF D8 FF E0 ... the JPEG data of the first page
...
50 4B 01 02 ... central directory entries, one per file
50 4B 05 06 ... end of central directory record
The details of the container (compression methods, ZIP64, UTF-8 names, encryption) are on the ZIP format page.
Rules readers follow#
There is no specification, but readers agree on a few rules:
| Rule | What readers do |
|---|---|
| Pages | every entry with an image extension (.jpg, .jpeg, .png, .gif, .webp, .bmp, .avif, .jxl) is a page |
| Order | pages are sorted by full path name, not by the order inside the ZIP. Most readers use natural sort (2.jpg before 10.jpg) |
| Cover | the first page in sort order, unless ComicInfo.xml marks another page as FrontCover |
| Folders | allowed; sorting by full path keeps chapter folders in order (Ch01/001.jpg, Ch02/001.jpg) |
| Ignored | non-image files, __MACOSX/ folders, hidden files (.DS_Store, ._001.jpg), Thumbs.db |
| Metadata | ComicInfo.xml in the archive root (case of the name varies; match it case-insensitively) |
Page names and sort order#
Sort order is the main source of broken comics. Plain string sorting puts 10.jpg before 2.jpg; natural sort compares runs of digits as numbers. Not every reader uses natural sort, so when you create a CBZ, zero-pad page numbers to the same width:
| Names | String sort | Natural sort |
|---|---|---|
1.jpg, 2.jpg, 10.jpg |
1, 10, 2 (wrong) | 1, 2, 10 |
001.jpg, 002.jpg, 010.jpg |
001, 002, 010 | 001, 002, 010 |
Other pitfalls: mixed case (Page2.jpg vs page10.jpg, compare case-insensitively), a credits page named zz_credits.jpg that sorts last on purpose, and names like cover.jpg that sort after 001.jpg (readers that look for “cover” in the name exist, but don’t rely on it).
Images inside#
| Image format | Notes |
|---|---|
| JPEG | the most common; color pages and scans |
| PNG | lossless; line art and black-and-white manga, larger files |
| WebP | 25-35% smaller than JPEG; supported by current readers, not by older e-readers |
| GIF, BMP, TIFF | rare; old scans |
| AVIF, JPEG XL | smallest files; support varies by reader |
A typical page is 1-3 MB as JPEG at 2000-3000 pixels tall. Double-page spreads are stored as one wide image.
ComicInfo.xml metadata#
ComicInfo.xml comes from ComicRack and is the de facto metadata standard; the Anansi Project maintains its schema (v2.0, with v2.1 as a draft). Komga, Kavita, YACReader, SumatraPDF, Calibre and ComicTagger read it. All elements are optional.
<?xml version="1.0" encoding="utf-8"?>
<ComicInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Title>The Court of Owls</Title>
<Series>Batman</Series>
<Number>1</Number>
<Volume>2011</Volume>
<Year>2011</Year>
<Month>11</Month>
<Writer>Scott Snyder</Writer>
<Penciller>Greg Capullo</Penciller>
<Publisher>DC Comics</Publisher>
<Genre>Superhero</Genre>
<PageCount>3</PageCount>
<LanguageISO>en</LanguageISO>
<Manga>No</Manga>
<Pages>
<Page Image="0" Type="FrontCover" ImageWidth="1988" ImageHeight="3056" />
<Page Image="1" />
<Page Image="2" Type="Advertisement" />
</Pages>
</ComicInfo>
| Element | Meaning |
|---|---|
Series, Number, Volume, Count |
series name, issue number (a string: 1, 1.5, Annual 1), volume (often the start year), total issues |
Title, Summary, Notes |
story title, description, free text |
Year, Month, Day |
publication date |
Writer, Penciller, Inker, Colorist, Letterer, CoverArtist, Editor |
credits; several names separated by commas |
Publisher, Imprint, Genre, Web |
publisher info, comma-separated genres, links (v2.1 adds Tags) |
PageCount, LanguageISO, Format, BlackAndWhite |
number of pages, language code, TPB / One-Shot etc. |
Manga |
Unknown, No, Yes, YesAndRightToLeft. YesAndRightToLeft tells readers to turn pages right to left |
Characters, Teams, Locations, StoryArc, SeriesGroup |
cataloging |
AgeRating, CommunityRating |
e.g. Teen, Mature 17+; rating 0-5 |
Pages/Page |
per-page info. Image is the 0-based page index in sorted order, not a file name. Type is FrontCover, InnerCover, Story, Advertisement, Editorial, Letters, Preview, BackCover, Roundup, Other or Deleted. DoublePage="true" marks spreads |
Other metadata formats exist but are less common: ComicBookInfo (JSON in the ZIP archive comment), CoMet (CoMet.xml) and MetronInfo (MetronInfo.xml, from the Metron project). comicbox reads and writes all of them; ComicTagger handles ComicInfo.xml, ComicBookInfo and CoMet.
Creating a CBZ#
Any ZIP tool creates a CBZ: put the images (and optionally ComicInfo.xml) in a folder, zip the contents and change the extension.
# Linux / macOS: -0 stores without compression
cd "Batman 001" && zip -0 -r "../Batman 001.cbz" .
# 7-Zip on any platform
7z a -tzip -mx=0 "Batman 001.cbz" "./Batman 001/*"
- Zip the folder contents, not the folder, unless you want one top-level folder in the archive (readers handle both).
- Zero-pad page numbers (
001.jpg). - Leave out
Thumbs.db,.DS_Storeand__MACOSX. - Use UTF-8 file names (modern ZIP tools set the UTF-8 flag; old tools write names in the system code page).
Converting#
- CBR, CB7, CBT to CBZ: extract the pages and zip them; nothing is re-encoded. comicbox (
comicbox -z file.cbr) does it in one step for all three; ComicTagger does it for CBR and CB7. - PDF to CBZ: extract embedded page images (e.g.
pdfimages -allfrom Poppler, ormutool extract) when every page is one scanned image; otherwise render pages to images. - CBZ to PDF or EPUB: Calibre converts comics to EPUB, MOBI and PDF. Kindle Comic Converter (KCC) optimizes comics for e-readers (resizes, splits spreads, sets right-to-left).
- Shrinking: re-encode pages to WebP or AVIF, or downscale to the reader’s screen size. This is lossy; keep the original.
Specifications and documentation#
- ComicInfo.xml documentation (Anansi Project): schema v2.0, element descriptions, v2.1 draft
- ComicInfo schema repository: XSD files for every version
- ZIP APPNOTE.TXT (PKWARE): the ZIP container format
- application/vnd.comicbook+zip IANA media type registration
- ComicBookInfo: JSON metadata stored in the ZIP comment
- MetronInfo: newer metadata schema from the Metron project
- Comic book archive on Wikipedia
Software that opens CBZ files#
| Software | Windows | macOS | Linux | Web | Can | Notes |
|---|---|---|---|---|---|---|
| SumatraPDF | ✓ | view | free, open source; reads ComicInfo.xml and ComicBookInfo, manga (right-to-left) mode | |||
| CDisplayEx | ✓ | view | free comic reader. Also on Android | |||
| YACReader | ✓ | ✓ | ✓ | view | free, open source (GPL-3.0); library manager and server. Also on Android and iOS | |
| MComix | ✓ | ✓ | view | free, open source | ||
| ComicRack Community Edition | ✓ | view, edit | free, open source continuation of ComicRack; library and ComicInfo.xml editor | |||
| Komga | ✓ | ✓ | ✓ | ✓ | view | free, open source comic server with web reader and OPDS |
| Kavita | ✓ | ✓ | ✓ | ✓ | view | free, open source reading server for comics, manga and books |
| Codex | ✓ | ✓ | view | free, open source comic server, uses comicbox for metadata | ||
| Calibre | ✓ | ✓ | ✓ | view, convert | free, open source; converts comics to EPUB, MOBI, PDF | |
| Okular | ✓ | ✓ | view | free, open source document viewer | ||
| Panels | ✓ | view | free with paid premium features. Also on iOS | |||
| Simple Comic | ✓ | view | free, open source | |||
| Mihon | view | free, open source manga reader; reads local CBZ. Also on Android | ||||
| ComicTagger | ✓ | ✓ | ✓ | edit, convert | free, open source; tags ComicInfo.xml, converts CBR to CBZ | |
| Kindle Comic Converter | ✓ | ✓ | ✓ | convert | free, open source; optimizes comics for e-readers | |
| 7-Zip | ✓ | ✓ | create, convert | free, open source; creates and extracts the ZIP container |
Libraries#
Open-source libraries that read and write CBZ files, with comic-specific examples (page order, cover, ComicInfo.xml). See all CBZ libraries for a comparison; general ZIP libraries are on the ZIP page.
| C/C++ | libarchive, libzip |
|---|---|
| C# | SharpCompress, System.IO.Compression |
| Java | Commons Compress, java.util.zip |
| Go | archive/zip, archives |
| Python | comicbox, zipfile |
| Ruby | rubyzip |
| Rust | zip |
| PHP | ZipArchive |
Related formats#
- CBR: the same idea in a RAR archive; read-only for open-source tools
- CB7: 7z archive; smaller only if pages are not already compressed
- CBT: uncompressed TAR archive
- ZIP: the container format of CBZ
- EPUB: fixed-layout EPUB is the e-book alternative for comics
- PDF: used for digital comics from publishers