7-Zip Archive
7z archives deliver the highest compression ratios among common formats using LZMA/LZMA2, with optional AES-256 encryption covering both file content and filenames. FileDex provides a complete 7z technical reference with binary anatomy, CLI commands, and format comparisons.
Archive format conversion requires format-specific decompression/recompression libraries not available in browser WASM.
Common questions
How do I open a 7z file on Windows without installing anything?
Windows 11 (23H2 update and later) extracts 7z files natively in File Explorer — right-click and select Extract All. On Windows 10, you need a free tool like 7-Zip or PeaZip.
Is 7z better than ZIP for compression?
7z with LZMA2 produces 30-70% smaller archives than ZIP with DEFLATE on text-heavy content like source code and documents. ZIP wins on compatibility since every OS opens it natively. Use 7z when size matters, ZIP when recipients may lack 7z software.
Can I password-protect a 7z archive?
7-Zip supports AES-256 encryption for both file content and filenames. Use the -mhe=on flag to enable header encryption — without it, filenames remain visible to anyone who opens the archive, even without the password.
Why does extracting one file from a 7z archive take so long?
Solid-mode 7z archives compress all files as a single data stream. Extracting a single file requires decompressing everything before it in the stream. Non-solid archives (-ms=off during creation) allow fast random access at the cost of slightly lower compression ratios.
What makes .7Z special
What is a 7z file?
7z is an open-source archive format introduced with the 7-Zip archiver, created by Igor Pavlov in 1999. It uses the LZMA (Lempel-Ziv-Markov chain Algorithm) compression method, achieving significantly higher compression ratios than ZIP or RAR in most cases. The format is entirely open and documented, with no patents or licensing fees, which has driven its widespread adoption in open-source software distribution.
Continue reading — full technical deep dive
7z is particularly effective on compressible data like source code, text documents, and executables — often achieving 50-70% smaller archives than ZIP for the same content. Binary and already-compressed files (images, videos, MP3s) see little benefit from any compression algorithm.
How to open 7z files
- 7-Zip (Windows) — Free, native support; right-click context menu integration
- PeaZip (Windows, Linux) — Free, open-source alternative
- The Unarchiver (macOS) — Free, supports 7z natively
- Keka (macOS) — Free archiver with drag-and-drop
- p7zip (Linux) — Official CLI port:
7z x archive.7z - WinRAR (Windows) — Commercial, but reads 7z
Technical specifications
| Property | Value |
|---|---|
| Compression | LZMA, LZMA2, BZip2, PPMd, Deflate |
| Encryption | AES-256 (file content and optionally filenames) |
| Solid archives | Supported (better compression for many small files) |
| Header encryption | Optional (hides filenames from unauthorized access) |
| Multi-volume | Supported (.7z.001, .7z.002, ...) |
| Max file size | 16 exabytes (theoretical) |
| Magic bytes | 37 7A BC AF 27 1C |
Common use cases
- Maximum compression: When smallest file size is the priority and extraction speed is secondary
- Software distribution: Open-source project releases on SourceForge and GitHub
- Secure backup: AES-256 encrypted archives protect sensitive data at rest
- Large file sets: Solid compression mode analyzes all files together, finding redundancy across them
- Multi-volume splits: Large archives can be split into fixed-size parts for easier transfer
7z vs ZIP vs RAR comparison
| Feature | 7z | ZIP | RAR |
|---|---|---|---|
| Compression ratio | Best | Moderate | Good |
| Encryption | AES-256 | AES-256 (newer) | AES-256 |
| Filename encryption | ✅ | ❌ | ✅ |
| Native OS support | Windows 11 | ✅ All OS | ❌ |
| Open format | ✅ | ✅ | ❌ (proprietary) |
| Self-extracting | ✅ | ✅ | ✅ |
Solid compression explained
7z's solid compression mode treats all files in an archive as a single data stream before compressing. This dramatically improves ratios when archiving many similar files (e.g., a folder of .js files or .md documents) because the compressor finds redundant patterns across files. The trade-off is that extracting a single file requires decompressing from the beginning of the stream, making random access slower.
Creating 7z archives from command line
# Compress with maximum compression
7z a -t7z -m0=lzma2 -mx=9 archive.7z /path/to/folder/
# Encrypt with password (AES-256 + filename encryption)
7z a -t7z -mhe=on -p"MyPassword" secure.7z files/
# Extract
7z x archive.7z -o/output/path/
Security considerations
7z's AES-256 encryption is strong, but the password strength is the real factor. Short or common passwords are vulnerable to brute-force attacks. When sharing encrypted 7z archives, never send the password through the same channel as the archive file. Note that without -mhe=on, filenames are visible even without the password — only file content is encrypted by default.
.7Z compared to alternatives
| Formats | Criteria | Winner |
|---|---|---|
| .7Z vs .ZIP | Compression ratio 7z with LZMA2 produces 30-70% smaller archives than ZIP with DEFLATE on text, source code, and executables. Solid compression amplifies this advantage for directories with many similar files. | 7Z wins |
| .7Z vs .ZIP | OS integration ZIP is natively supported on Windows, macOS, and Linux. 7z requires third-party software on macOS and Linux (except Windows 11 23H2+). | ZIP wins |
| .7Z vs .RAR | Licensing 7z is fully open-source with no patents or licensing fees. RAR is proprietary — creating RAR archives requires a WinRAR license, and the compression algorithm is patent-protected. | 7Z wins |
| .7Z vs .RAR | Error recovery RAR supports recovery records that can reconstruct damaged archive segments. 7z has no built-in error recovery mechanism — a corrupted packed stream in solid mode can make all files after the damage point unrecoverable. | RAR wins |
Technical reference
- MIME Type
application/x-7z-compressed- Magic Bytes
37 7A BC AF 27 1C7z signature bytes.- Developer
- Igor Pavlov
- Year Introduced
- 1999
- Open Standard
- Yes
7z signature bytes.
Binary Structure
A 7z file uses a reverse-seeking architecture. The file begins with a 12-byte Signature Header: 6-byte magic (37 7A BC AF 27 1C), 2-byte format version (major.minor), and 4-byte CRC of the next 20 bytes. Immediately after the Signature Header is the Start Header (20 bytes): NextHeaderOffset (8 bytes, offset to the encoded Header from end of Start Header), NextHeaderSize (8 bytes), and NextHeaderCRC (4 bytes). Between the Start Header and the encoded Header lies packed stream data (compressed file content). The encoded Header at the END of the archive contains the file/folder metadata database — folder structures, codec chains, file names, timestamps, sizes, CRC values, and empty stream markers. To open a 7z file, the reader seeks to byte 12 to read the Start Header, then jumps to the computed offset (12 + 20 + NextHeaderOffset) to read the encoded Header. This end-of-file metadata placement allows 7z archives to be created in a streaming fashion without backpatching.
| Offset | Length | Field | Example | Description |
|---|---|---|---|---|
0x00 | 6 bytes | Signature Magic | 37 7A BC AF 27 1C | Fixed 7z file signature. Any other value means the file is not a valid 7z archive. |
0x06 | 1 byte | Format Version Major | 00 | Major version of the 7z format. Current archives use version 0.4. |
0x07 | 1 byte | Format Version Minor | 04 | Minor version. Combined with major byte, defines the archive format revision. |
0x08 | 4 bytes | Start Header CRC | varies | CRC-32 of the 20-byte Start Header that follows. Detects corruption in the critical offset data. |
0x0C | 8 bytes | NextHeaderOffset | varies | Little-endian uint64 offset from end of Start Header (byte 32) to the encoded Header block. |
0x14 | 8 bytes | NextHeaderSize | varies | Little-endian uint64 size in bytes of the encoded Header block. |
0x1C | 4 bytes | NextHeaderCRC | varies | CRC-32 of the encoded Header block. Validates metadata integrity before parsing. |
Attack Vectors
- Zip bomb equivalent: deeply nested 7z archives with extreme compression ratios can expand to terabytes of data, exhausting disk space and memory during extraction
- Path traversal: crafted filenames with ../ sequences can write files outside the intended extraction directory if the extractor does not sanitize paths
- Encrypted archives bypass content scanning — malware distributed in password-protected 7z files evades antivirus gateway inspection
Mitigation: FileDex does not extract 7z archives server-side. All format analysis is reference-only. When handling untrusted 7z files locally, use 7-Zip with -snl (disable symlink creation) and extract to an isolated directory. Verify archive contents with 7z l before extraction.