.7Z 7-Zip Archive
.7z

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.

بنية الصيغة
Header magic bytes
Entries compressed files
Index directory
ArchiveLZMA/LZMA2AES-256Open Source1999
بواسطة FileDex
غير قابل للتحويل

Archive format conversion requires format-specific decompression/recompression libraries not available in browser WASM.

أسئلة شائعة

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.

ما يميز .7Z

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.

اكتشف التفاصيل التقنية

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.

المرجع التقني

نوع MIME
application/x-7z-compressed
Magic Bytes
37 7A BC AF 27 1C 7z signature bytes.
المطوّر
Igor Pavlov
سنة التقديم
1999
معيار مفتوح
نعم
00000000377ABCAF271C 7z..'.

7z signature bytes.

البنية الثنائية

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.

OffsetLengthFieldExampleDescription
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.
1999Igor Pavlov releases 7-Zip archiver and the 7z format with LZMA compression2004LZMA SDK published as public domain, enabling third-party 7z support2006LZMA2 codec added, improving multi-threaded compression and handling of incompressible data2010p7zip ports 7-Zip to Unix/Linux/macOS as a CLI tool2023Windows 11 gains native 7z extraction support in File Explorer (23H2 update)
Create a 7z archive with maximum LZMA2 compression أخرى
7z a -t7z -m0=lzma2 -mx=9 archive.7z folder/

-t7z forces 7z format. -m0=lzma2 selects LZMA2 as the compression method. -mx=9 sets ultra compression level — slowest but smallest output.

Extract a 7z archive to a specific directory أخرى
7z x archive.7z -o/output/path/

x extracts with full directory structure preserved. -o sets the output directory (no space between flag and path). Use e instead of x to extract without directory structure.

List archive contents without extracting أخرى
7z l archive.7z

l (lowercase L) lists all files in the archive with sizes, dates, and compression ratios. Add -slt for detailed technical output including CRC values and compression method per file.

Create an AES-256 encrypted archive with filename encryption أخرى
7z a -t7z -mhe=on -p archive.7z sensitive_files/

-mhe=on enables header encryption, hiding filenames from anyone without the password. Without this flag, filenames are visible even without the password — only file content is encrypted by default. The -p flag prompts for a password interactively.

7Z ZIP transcode lossless ZIP is natively supported on Windows, macOS, and Linux without third-party software. Converting 7z to ZIP trades compression ratio for universal accessibility when distributing files to non-technical recipients.
7Z TAR.GZ transcode lossless Linux software packaging and deployment pipelines expect tar.gz archives. Repackaging 7z content as tar.gz preserves Unix permissions and ownership when the tarball is created on a Unix system.
متوسط

نقاط الضعف

  • 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

الحماية: 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.

7-Zip أداة
Official 7z archiver for Windows with GUI and CLI (7z.exe)
p7zip أداة
POSIX port of 7-Zip CLI for Linux and macOS
PeaZip أداة
Cross-platform GUI archiver supporting 7z, ZIP, RAR, and 200+ formats
LZMA SDK مكتبة
Public-domain LZMA/LZMA2 compression library in C, C++, C#, Java
node-7z مكتبة
Node.js wrapper for 7-Zip CLI with streaming API