Introduction
RAR 5.0 is the archive format that WinRAR has written by default since version 5.0 in 2013. It replaced the RAR 1.5 to 4.x format with a new header layout that uses variable-length numbers throughout, so file and archive sizes have no 4 GB limits. It also brought AES-256 encryption, optional BLAKE2sp hashes of the files, larger dictionaries and stronger recovery records. RARLAB publishes the header layout; the compression method is known only through the UnRAR source code.
Multi-volume archives are named name.part1.rar,
name.part2.rar and so on.
Structure
After the signature the archive is a series of blocks. Each block header starts with a CRC-32 of the rest of the header, then the header size, the header type and the header flags, all but the CRC stored as variable-length integers (seven bits per byte, the top bit set when another byte follows). Flags say whether an extra area and a data area follow; a file’s compressed data is the data area of its file header.
0SignatureRar!1A 07 01 008 bytes8Encryption header type 4, only when the headers are encryptedoptional…Main archive header type 1, archive flags such as volume, solid and lockedvaries…File headers and data type 2, each followed by its compressed datarepeated…Service headers type 3, such as comments, NTFS streams and recovery recordsoptional…End of archive type 5varies
A file header holds the file’s flags, unpacked size, attributes, an optional modification time and CRC-32, the compression information (version, solid flag, method and dictionary size), the host operating system and the name in UTF-8. Its extra area can add encryption settings, a BLAKE2sp hash, high-precision times, version numbers and link targets. A self-extracting archive has a program in front of the signature.
Variants
- RAR 5.0 archive (RAR5) – WinRAR’s current archive: CRC-32 block headers with variable-length numbers
- RAR 1.5 to 4.x archive (RAR4) – the older RAR format: blocks with a fixed 7-byte header and 16-bit CRC
Links
Software
- WinRAR – the archiver that makes RAR 5.0 files, with command-line RAR for other systems (Windows, macOS, Linux)
- 7-Zip – free archiver that extracts RAR files (Windows)
- The Unarchiver – free extractor for many formats (macOS)
- PeaZip – free archiver that extracts RAR files (Windows, macOS, Linux)
Developers
- UnRAR source – RARLAB’s extraction code (C++)
- libarchive – reads RAR 5.0 archives among many formats (C)
- rarfile – reads archives with the help of an external extractor (Python)
Reference
- RAR 5.0 archive format – RARLAB’s technical note on the headers