The 7Z (.7z) Format, Explained
iLoveConverter Team 3 min read
On this page
7Z is the archive format that proved open-source compression can outperform proprietary alternatives. Created by Igor Pavlov alongside 7-Zip, 7Z consistently produces smaller archives than ZIP, RAR, or TAR.GZ on typical real-world data. Its secret is LZMA2, a modern LZ-based compressor with large dictionary support, plus an optional solid mode that further squeezes repeated data across file boundaries.
Structure of a 7Z file
A .7z file begins with a 32-byte header:
- Signature
37 7A BC AF 27 1C. - Archive version (4 bytes), start header CRC (4 bytes).
- Next header offset and next header size (8 bytes each), both compressed.
- Next header CRC (4 bytes).
The header describes the archive contents, compression methods, encryption, and file list. Data is stored as compressed streams called “packed streams.” Multiple files can share a packed stream in solid mode.
LZMA2: the engine
LZMA2 is the successor to LZMA and the default 7Z compressor. Key features:
- Up to 1 TB dictionary — ZIP and gzip max out at 32 KB; LZMA2 can “look back” huge distances.
- Adaptive dictionary switching — different chunks use different dictionary sizes.
- Delta filters — pre-processing improves compression for image-like and audio-like data.
- Multithreaded — 7-Zip can use multiple cores for both compression and decompression.
The -mx flag sets the compression level (-mx1 fastest to -mx=9 ultra), which scales dictionary size and other parameters.
Solid compression
Solid mode (-ms=on) concatenates multiple files into one stream before compressing. This works brilliantly when many files share data — for example, a directory full of JAR files or source code. Compression ratios can improve by 20–50%, but there is a tradeoff: you cannot extract a single file without decompressing everything that comes before it in the stream. For archives you expect to extract one file from, leave solid mode off.
Encryption
7Z supports AES-256 encryption with SHA-256 key derivation. You can encrypt file contents only, or both contents and the file list (-mhe=on). Note: 7Z encryption is strong, but archive recovery tools (like RAR’s repair feature) are not available for 7Z, so always keep a backup of the original files.
Compression ratio comparison
Approximate ratios on typical data:
| Format | Ratio | Speed |
|---|---|---|
| 7Z LZMA2 -mx9 | 5–8x | Slowest |
| RAR5 -m5 | 4–7x | Medium-slow |
| ZIP DEFLATE -9 | 2–4x | Fast |
| TAR.GZ | 2–4x | Fast |
Your mileage varies by data type. Text, source code, and CSV files compress best. Already-compressed media (JPEG, MP4, PNG) barely shrink.
Converting and extracting
7z a archive.7z folder/ # create archive
7z a -tzip archive.zip folder/ # 7-Zip can also create ZIP
7z x archive.7z # extract with full paths
7z l archive.7z # list contents
7z t archive.7z # test integrity
Common problems
- “Cannot open file as archive” — download may be corrupted, or the file may actually be RAR/ZIP misnamed as
.7z. - Slow extraction on huge solid archives — decompression must start from the beginning; this is by design.
- Windows native support — Windows Explorer does not natively open 7Z; you need 7-Zip, Bandizip, or PeaZip.
- Password prompt on opening — if you used
-mhe=on, the file listing itself is encrypted, requiring the password just to see what is inside.
FAQ
Is 7Z better than ZIP?
For size, yes. For compatibility, no. ZIP is universally supported without extra software. If your recipients may not install tools, ZIP is safer. If size matters, 7Z wins.
Is 7Z patent-free?
LZMA/LZMA2 are in the public domain. The 7Z format specification is open. No royalties are required.
Can 7Z open RAR files?
Yes, 7-Zip can extract most RAR5 archives, but it cannot create RAR files — that remains a WinRAR/WinRAR license restriction.
What is a “next header”?
The header offset stored at the start points to a compressed block containing the real file listing. This indirection lets 7Z add files to an existing archive without rewriting the entire header — useful for append operations.
Try it yourself — free, right in your browser
Everything mentioned in this guide runs locally on this site: no upload, no watermark, no sign-up.
Format deep-dives: 7Z (.7z) , ZIP (.zip) , RAR (.rar) , TAR (.tar) , GZ (.gz)