All formats

CBT (Comic Book TAR archive)

Full nameComic Book TAR archive
Extensions.cbt
MIME typeapplication/x-cbt (not registered with IANA)
Typecontainer (TAR archive of images, no compression)
Starts withthe name of the first file; ustar at offset 257 (75 73 74 61 72)
Specificationno formal spec; container is POSIX tar / pax, metadata is ComicInfo.xml
Maintained byno owner (de facto standard); tar is a POSIX standard
Licenseopen, royalty-free

A CBT file is a TAR archive that holds the pages of a comic book as image files, usually JPEG or PNG. A reader reads the archive, sorts the image names and shows them in that order. Rename it to .tar and any tar tool extracts it.

TAR doesn’t compress, which costs nothing for comics: JPEG and PNG pages are already compressed. CBT is simple to write (every Unix system has tar) but rare in practice. TAR has no index, so a reader must scan the archive to find a page. Most desktop readers support CBT; some mobile apps and comic servers don’t.

When to use CBT#

File structure#

A CBT is a plain TAR archive. The page and metadata rules are the same as for CBZ: every image entry is a page, pages are sorted by name (natural sort in most readers), the first page is the cover, and an optional ComicInfo.xml carries metadata. See CBZ file structure for the rules, the sort-order pitfalls and the ComicInfo.xml schema.

Bone 01.cbt
├── ComicInfo.xml          optional metadata
├── 001.jpg                cover
├── 002.jpg
└── ...

A tar archive is a sequence of 512-byte blocks: a header block for each file, followed by the file data padded to a multiple of 512 bytes. Two zero blocks mark the end.

30 30 31 2E 6A 70 67 00 ...   offset 0: file name "001.jpg" (100 bytes)
30 30 30 30 36 34 34 00       offset 100: mode "0000644" (octal text)
...                           uid, gid
30 30 30 30 30 37 33 31 34 34 31 00   offset 124: size in octal ("00000731441" = 242465 bytes)
...                           mtime, checksum
30                            offset 156: type flag '0' = regular file
...
75 73 74 61 72 00 30 30       offset 257: "ustar\0" + version "00" (POSIX ustar)
...                           owner, group, prefix (up to offset 512)
FF D8 FF E0 ...               offset 512: JPEG data, padded to a 512-byte boundary
Header field Offset Size Notes
name 0 100 file path; longer names use the prefix field (ustar), a pax x header or GNU L entry
size 124 12 octal ASCII
typeflag 156 1 0 file, 5 directory, x pax extended header, L GNU long name
magic 257 6 ustar\0 (POSIX) or ustar (GNU)
prefix 345 155 directory part of long paths (ustar)

The container details (pax headers, GNU extensions) are on the TAR format page.

Reading pages from a tar#

TAR has no central directory. To list pages, a reader walks all headers: for each one it reads 512 bytes and seeks past the data. With uncompressed tar that is fast (one seek per file), and readers build an index of name to offset once, then read pages directly. A gzip-compressed tar would need full decompression for every scan, which is why CBT should stay uncompressed.

Entries to skip#

Besides the usual __MACOSX and dotfiles, tar archives created on macOS contain AppleDouble files (._001.jpg) with extended attributes, and pax archives contain PaxHeader entries when a tool doesn’t understand them. Libraries handle pax headers; filter ._* names yourself.

Creating a CBT#

Shell
# GNU tar or bsdtar; run inside the folder so paths have no prefix
cd "Bone 01" && tar -cf "../Bone 01.cbt" *
# macOS: don't store extended attributes as ._ files
COPYFILE_DISABLE=1 tar -cf "Bone 01.cbt" -C "Bone 01" .
# 7-Zip
7z a -ttar "Bone 01.cbt" "./Bone 01/*"

Zero-pad page numbers (001.jpg) so readers without natural sort keep the order.

Converting#

Specifications and documentation#

Software that opens CBT files#

SoftwareWindowsmacOSLinuxWebCanNotes
SumatraPDF✓viewfree, open source; reads ComicInfo.xml, manga (right-to-left) mode
CDisplayEx✓viewfree comic reader
MComix✓✓viewfree, open source
Kavita✓✓✓✓viewfree, open source reading server
Okular✓✓viewfree, open source document viewer
7-Zip✓✓create, convertfree, open source
tar✓✓✓create, convertbuilt into Linux, macOS (bsdtar) and Windows 10+ (tar.exe)

Libraries#

Open-source libraries that read and write CBT files, with comic-specific examples (page order, cover, ComicInfo.xml, creating a CBT). See all CBT libraries; general TAR information is on the TAR page.

C/C++libarchive
C#SharpCompress, System.Formats.Tar
JavaCommons Compress
Goarchive/tar
Pythoncomicbox, tarfile
Rubyffi-libarchive, minitar
Rusttar
PHPPharData