All formats

CBZ (Comic Book ZIP archive)

Full nameComic Book ZIP archive
Extensions.cbz
MIME typeapplication/vnd.comicbook+zip (registered with IANA)
Typecontainer (ZIP archive of images)
Starts with50 4B 03 04 (PK\x03\x04, a ZIP local file header)
Specificationno formal spec; container is ZIP (PKWARE APPNOTE), metadata is ComicInfo.xml
Maintained byno owner (de facto standard); ComicInfo schema by the Anansi Project
Licenseopen, 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#

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
<?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.

Shell
# 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/*"

Converting#

Specifications and documentation#

Software that opens CBZ files#

SoftwareWindowsmacOSLinuxWebCanNotes
SumatraPDF✓viewfree, open source; reads ComicInfo.xml and ComicBookInfo, manga (right-to-left) mode
CDisplayEx✓viewfree comic reader. Also on Android
YACReader✓✓✓viewfree, open source (GPL-3.0); library manager and server. Also on Android and iOS
MComix✓✓viewfree, open source
ComicRack Community Edition✓view, editfree, open source continuation of ComicRack; library and ComicInfo.xml editor
Komga✓✓✓✓viewfree, open source comic server with web reader and OPDS
Kavita✓✓✓✓viewfree, open source reading server for comics, manga and books
Codex✓✓viewfree, open source comic server, uses comicbox for metadata
Calibre✓✓✓view, convertfree, open source; converts comics to EPUB, MOBI, PDF
Okular✓✓viewfree, open source document viewer
Panels✓viewfree with paid premium features. Also on iOS
Simple Comic✓viewfree, open source
Mihonviewfree, open source manga reader; reads local CBZ. Also on Android
ComicTagger✓✓✓edit, convertfree, open source; tags ComicInfo.xml, converts CBR to CBZ
Kindle Comic Converter✓✓✓convertfree, open source; optimizes comics for e-readers
7-Zip✓✓create, convertfree, 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
JavaCommons Compress, java.util.zip
Goarchive/zip, archives
Pythoncomicbox, zipfile
Rubyrubyzip
Rustzip
PHPZipArchive