All formats

CBR (Comic Book RAR archive)

Full nameComic Book RAR archive
Extensions.cbr
MIME typeapplication/vnd.comicbook-rar (registered with IANA)
Typecontainer (RAR archive of images)
Starts with52 61 72 21 1A 07 00 (Rar! RAR 1.5-4.x) or 52 61 72 21 1A 07 01 00 (RAR 5.0+)
Specificationno formal spec; container is RAR (RARLAB technote), metadata is ComicInfo.xml
Maintained byno owner (de facto standard); RAR format by RARLAB
LicenseRAR is proprietary: free to extract (UnRAR source license), creating RAR needs WinRAR

A CBR file is a RAR 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 it to .rar and WinRAR, 7-Zip or unrar extracts it.

CBR was common for scanned comics shared online, because WinRAR was popular and RAR compressed slightly better than ZIP for some content. For comic pages (already compressed JPEG/PNG) the size difference is negligible. Readers support CBR well, but open-source software can only read RAR, never write it: convert CBR to CBZ when you edit or re-tag a comic.

When to use CBR#

File structure#

A CBR is a RAR 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.

Saga 001.cbr
├── ComicInfo.xml          optional metadata
├── Saga 001 - 000.jpg     cover
├── Saga 001 - 001.jpg
└── ...

RAR4 and RAR5#

RAR has two incompatible archive versions. Check the signature before choosing a library: some older libraries only read RAR4.

Version Signature Created by Notes
RAR 1.5-4.x (RAR4) 52 61 72 21 1A 07 00 WinRAR before 5.0, or WinRAR 5+ with the RAR4 option most CBR files from the 2000s and 2010s
RAR 5.0+ (RAR5) 52 61 72 21 1A 07 01 00 WinRAR 5.0 and later (default) different header layout, larger dictionary, BLAKE2 checksums
52 61 72 21 1A 07 01 00   RAR5 signature "Rar!\x1a\x07\x01\x00"
xx xx xx xx               CRC-32 of the main archive header
xx                        header size (variable-length integer)
01                        header type: 1 = main archive header
...                       file headers (type 2), each followed by the packed data

The RAR container details are on the RAR format page.

Solid archives#

In a solid RAR, all files are compressed as one continuous stream. This compresses better when files are similar, but a reader can’t decompress page 50 without decompressing pages 1-49 first. Comic readers either extract the whole archive to a temporary folder or decompress it into memory once. Non-solid archives allow direct access to each page.

CBR files that are really ZIP#

Many files named .cbr are ZIP archives (and some .cbz files are RAR archives), because people renamed the extension. Good readers detect the type from the first bytes (Rar! or PK\x03\x04), not the extension. Do the same in your code: check the signature, then pick the RAR or ZIP library.

Converting CBR to CBZ#

Converting is lossless: extract the pages and put them into a ZIP archive. Nothing is re-encoded.

Shell
# with unrar and zip
mkdir pages && unrar e -idq "Saga 001.cbr" pages/
cd pages && zip -0 -r "../Saga 001.cbz" . && cd .. && rm -r pages
# with 7-Zip (needs the RAR codec, included in the official 7-Zip builds)
7z x -opages "Saga 001.cbr" && 7z a -tzip -mx=0 "Saga 001.cbz" ./pages/*
# with comicbox (keeps metadata)
comicbox -z "Saga 001.cbr"

ComicTagger also converts CBR to CBZ. Keep the folder structure and the file names: they define the page order.

Specifications and documentation#

Software that opens CBR files#

SoftwareWindowsmacOSLinuxWebCanNotes
SumatraPDF✓viewfree, open source; RAR4 and RAR5, reads ComicInfo.xml, manga (right-to-left) mode
CDisplayEx✓viewfree comic reader. Also on Android
YACReader✓✓✓viewfree, open source (GPL-3.0); RAR4 and RAR5. Also on Android and iOS
MComix✓✓viewfree, open source; needs unrar or libunrar
ComicRack Community Edition✓view, convertfree, open source; converts to CBZ to write metadata
Komga✓✓✓✓viewfree, open source comic server
Kavita✓✓✓✓viewfree, open source reading server; RAR and RAR5
Calibre✓✓✓view, convertfree, open source; converts CBR to EPUB, MOBI, PDF
Okular✓✓viewfree, open source; needs unrar for CBR
Panels✓viewfree with paid premium features. Also on iOS
Simple Comic✓viewfree, open source
ComicTagger✓✓✓convertfree, open source; converts CBR to CBZ to tag it
WinRAR✓create, convertcommercial (trial); the only program that creates RAR archives
7-Zip✓✓convertfree, open source; extracts RAR4 and RAR5

Libraries#

Open-source libraries that read CBR files, with comic-specific examples (page order, cover, ComicInfo.xml, converting to CBZ). No open-source library writes RAR. See all CBR libraries; general RAR information is on the RAR page.

C/C++libarchive, UnRAR
C#SharpCompress
Javajunrar
Goarchives, rardecode
Pythoncomicbox, rarfile
Rubyffi-libarchive
Rustcompress-tools, unrar