Introduction
7z is the archive format of 7-Zip, the free archiver Igor Pavlov first released in 1999. It is known for small archives: by default it uses LZMA2 compression and compresses many files together as one solid stream, so similar files help each other compress. It can also encrypt both the contents and the file names with AES-256.
Structure
A 7z file starts with a fixed 32-byte signature header. The compressed data comes next, and the header that lists the files comes at the end, where the signature header points to it. The end header is often compressed itself. Numbers are little-endian.
0Signature header37 7A BC AF 27 1C(7zand four fixed bytes), version, CRC12 bytes12Next header pointer offset, size and CRC of the end header20 bytes32Packed streams the compressed datavaries…End header streams, coders, and the names, sizes and times of the filesvaries
Each folder of packed data names the coders that produced it, such as LZMA, LZMA2, PPMd, BZip2 or Deflate, along with filters such as BCJ for machine code and AES-256 for encryption.
Links
Software
- 7-Zip (Windows, with a command-line version for macOS and Linux)
- PeaZip (Windows, macOS, Linux)
- WinRAR (Windows)
- The Unarchiver (macOS)
Developers
- LZMA SDK, Igor Pavlov’s code for LZMA and 7z, in C, C++, C# and Java
- libarchive, C library that reads and writes 7z among many formats
- py7zr, Python library
Reference
7zFormat.txt, the format description in the LZMA SDK and the 7-Zip source code