What Is 7Z?
7Z (pronounced "seven-zip") is a high-compression archive format created by Igor Pavlov and distributed as part of the open-source 7-Zip archiver utility, first released in 1999. The "7" refers to the 7-Zip application version at which the format was introduced; the "Z" stands for zip, generically.
Unlike ZIP and RAR, 7Z was designed from the start for maximum compression, using the LZMA (Lempel–Ziv–Markov chain algorithm) and later LZMA2 compression algorithms, which consistently outperform ZIP's Deflate algorithm by 30–70% on typical file collections.
The 7Z format specification is open and documented in the 7-Zip source code (SDK available at 7-zip.org), making it implementable by anyone. 7-Zip itself is free, open-source software licensed under GNU LGPL.
Architecture: Container vs. Codec
7Z separates two concerns:
- Container format — how files, metadata, and the archive structure are organised
- Codec — how data is compressed or encrypted
This separation means 7Z archives can use different compression algorithms for different files within the same archive, and can be extended with new codecs without changing the container format.
The current codec suite includes:
- LZMA — original, dictionary-based compression
- LZMA2 — improved multi-threaded version of LZMA
- Deflate / Deflate64 — ZIP-compatible; used for maximum compatibility
- BZip2 — alternative to LZMA for certain data types
- PPMd — context modelling; excellent for text and source code
- BCJ / BCJ2 — executable preprocessors that improve compression of .exe, .dll files
- Delta — preprocessor for audio and graphics data patterns
- AES-256 — encryption (not compression)
Binary Structure
Unlike ZIP (which uses a human-readable file-based structure with fixed-length headers), 7Z uses a flexible, header-driven format:
Signature Header (32 bytes)
SignatureBytes: { '7', 'z', 0xBC, 0xAF, 0x27, 0x1C }
ArchiveVersion: Major, Minor
StartHeaderCRC: CRC32 of the next 20 bytes
NextHeaderOffset: offset to the main header from end of signature header
NextHeaderSize: size of main header
NextHeaderCRC: CRC32 of main header
Packed Data
[Compressed data streams, as many as needed]
Main Header (at NextHeaderOffset)
Contains: streams info, files info, coding methods, CRCs, folder structure
This header is itself compressed and may be encrypted
The Main Header is the archive's index, equivalent to ZIP's Central Directory. Critically, the Main Header can be compressed and encrypted, hiding all metadata — file names, sizes, timestamps — from anyone without the password. This is the key feature that distinguishes 7Z from ZIP's encryption model.
LZMA2 Algorithm
LZMA2 is the core of 7Z's compression superiority. It is a dictionary compression algorithm based on LZ77 with a Markov chain range encoder (replacing Huffman coding) and several optimisations:
Dictionary size: 7Z allows dictionary sizes up to 1.5 GB (LZMA2). ZIP's Deflate is limited to 32 KB. A larger dictionary means the compressor can find matches over longer distances in the data stream, dramatically improving compression on large files or groups of similar files.
Literal coding: LZMA uses a context-dependent literal model — the probability of each byte depends on recent preceding bytes. This context modelling is more accurate than Huffman coding's context-independent approach.
Multi-threading: LZMA2 (unlike LZMA) divides the input stream into blocks that can be compressed in parallel using multiple CPU cores, dramatically reducing compression time on modern hardware.
Compression levels in 7-Zip:
| Level | Setting | Dict. Size | Time | Ratio |
|---|---|---|---|---|
| Store | -mx0 | — | Very fast | None |
| Fastest | -mx1 | 64 KB | Fast | Low |
| Fast | -mx3 | 1 MB | Fast | Medium |
| Normal | -mx5 | 16 MB | Medium | Good |
| Maximum | -mx7 | 64 MB | Slow | Better |
| Ultra | -mx9 | 64 MB | Very slow | Best |
Solid Archives
One of 7Z's most powerful features is solid compression. In a solid archive, all files are concatenated into a single data stream before compression, allowing the compressor to find matches across file boundaries.
Example: 1000 HTML files each containing similar boilerplate markup compress far better as a solid archive than as 1000 individually compressed members. The compressor recognises the repeated <!DOCTYPE html><html><head> pattern across all files, achieving ratios approaching 95% on homogeneous collections.
Trade-off: In a solid archive, extracting a single file requires decompressing all previous files in the solid block first. This makes random access expensive. 7-Zip mitigates this by allowing configurable solid block sizes (compress up to N MB as solid, then start a new block).
Header Encryption
When a password is set in 7Z, both the data and the header are encrypted with AES-256:
- File names are hidden
- File sizes are hidden
- Timestamp metadata is hidden
- Directory structure is hidden
An attacker looking at an AES-encrypted 7Z archive sees only the archive's total size — nothing else. This is superior to ZIP's encryption, which encrypts only file data while leaving file names visible.
Split Archives
7Z natively supports splitting archives into volumes of a specified size. Each volume is named archive.7z.001, archive.7z.002, etc. This is useful for:
- Distributing archives that exceed email attachment size limits
- Backing up to removable media with size limits
- Multi-volume downloads with resume capability
7Z vs. ZIP vs. RAR
| Feature | 7Z | ZIP | RAR |
|---|---|---|---|
| Compression algorithm | LZMA2 | Deflate | proprietary |
| Compression ratio | Excellent | Good | Excellent |
| Open specification | Yes | Yes | No |
| Free tools | Yes (7-Zip) | Yes (built-in OS) | Limited (WinRAR trial) |
| Native OS support | Third-party needed | Built-in | Third-party needed |
| Header encryption | Yes | No | Yes |
| Solid archives | Yes | No | Yes |
| Recovery records | No | No | Yes |
| Multi-volume | Yes | Yes | Yes |
| Max file size | Virtually unlimited | 4 GB (ZIP64: unlimited) | Virtually unlimited |
RAR's unique advantage: Recovery records — extra parity data that allows corrupt archive volumes to be reconstructed. Neither ZIP nor 7Z supports this natively.
Use Cases
7Z is optimal for:
- Long-term storage — maximum compression for large file sets
- Software distribution — LZMA2 solid compression of executable files (BCJ preprocessing helps here)
- Backups — especially where encrypted header privacy matters
- Internal workflow — when all recipients can install 7-Zip
ZIP is better when:
- Cross-platform compatibility — recipients may not have 7-Zip
- Format container — many formats (EPUB, DOCX) require standard ZIP
- Random access required — quick extraction of individual files
- Web delivery — web servers natively serve ZIP; browser download managers understand ZIP
Platform Support
Windows: 7-Zip (open-source, free) is the primary tool. Also supported by WinRAR, PeaZip, Bandizip.
macOS: 7-Zip is available via Homebrew (brew install sevenzip); The Unarchiver and Keka also support 7Z.
Linux: 7zip or p7zip package in most distributions. Command: 7z a archive.7z files/ to create, 7z x archive.7z to extract.
Mobile: Fewer native apps; most file managers on Android/iOS support 7Z, but it is less common than ZIP in mobile workflows.
Command-Line Usage
# Create archive (Ultra compression, AES-256 encryption)
7z a -mx9 -mhe=on -p archive.7z directory/
# List contents
7z l archive.7z
# Extract to directory
7z x archive.7z -o./output/
# Test archive integrity
7z t archive.7z
# Create split archive (200 MB volumes)
7z a -v200m archive.7z directory/
The -mhe=on flag enables header encryption, hiding all file names from unauthorized users.
Converting FROM 7Z
7Z → ZIP: 7z a -tzip output.zip @list.txt after extracting, or directly using 7-Zip's "Convert Archives" feature. Compression ratio will decrease; compatibility increases.
7Z → TAR.GZ: Extract first, then recompress with tar czf archive.tar.gz directory/.
ZIP → 7Z: Drag into 7-Zip GUI and choose "Add to archive" → 7Z format, or command line 7z a -t7z output.7z @list.txt.
Summary
7Z is the premier high-compression archive format for users who prioritise storage efficiency and privacy over universal compatibility. Its LZMA2 algorithm, solid archive support, header encryption, and open specification make it the best technical choice for long-term archiving, software distribution, and sensitive file storage. The trade-off is platform dependency — not all operating systems include 7Z support natively, requiring the installation of 7-Zip or equivalent tools. For everyday file sharing where recipients may not have specialised software, ZIP remains more practical.
Related conversions
Archive format conversions used most often: