File types · Explainer

The 7Z file (.7z)

A 7z file is an archive made by 7-Zip: files and folders packed into one file, usually compressed harder than a ZIP. This guide explains what's inside one, how solid compression and header encryption work, how it compares with ZIP and RAR, and has free sample 7z files to download for testing.

At a glance

Full name
7z archive, the native format of 7-Zip
Extensions
.7z; split archives use .7z.001, .7z.002 …
MIME type
application/x-7z-compressed (common, not registered with IANA)
Kind
Binary archive, lossless; files can share one compressed block (solid)
Standard or owner
Igor Pavlov, 7-Zip's author; the format is documented in the 7-Zip source and free of licence restrictions
First released
1999, with the first 7-Zip
Compression
LZMA2 by default in current 7-Zip; also LZMA, PPMd, BZip2, Deflate or none (Copy), plus filters such as BCJ2 for programs
Encryption
AES-256; file names can be encrypted too
Opens with
7-Zip on Windows, built-in in Windows 11 since late 2023 (no passwords); 7zz or 7z on Linux and macOS; Keka, The Unarchiver
Magic number
37 7A BC AF 27 1C (7z + 4 fixed bytes), then the version 00 04

The basics

What is a 7z file?

A 7z file is an archive: one file that holds other files and folders, compressed. It's the native format of 7-Zip, the free, open-source archiver Igor Pavlov first released in 1999. People use 7z to ship large downloads, game mods, backups and software, because it usually makes smaller files than ZIP.

Compression is lossless: every file comes out exactly as it went in, checked with CRC-32. The gain over ZIP comes from three things:

  • Better algorithms. LZMA and LZMA2 search a much larger window for repeated data than ZIP's Deflate, which only looks back 32 KB.
  • Solid compression. Many files can be compressed as one stream, so repeats between files count too.
  • Filters. BCJ2 and similar filters rearrange program code before compression, so .exe and .dll files shrink more.

7z also supports AES-256 encryption that can hide the file names, not just the contents. The cost is compatibility: Windows only opens 7z files by itself in recent versions of Windows 11, and Macs and phones usually need an app.

Anatomy

What's inside a 7z file

A 7z file starts with a fixed 32-byte signature header that points to the end of the file. Next come the packed streams, the compressed data. Last comes the header, the table of contents, which is usually compressed itself. Here is our sample-archive.7z, byte by byte at the start and end; numbers are little-endian.

sample-archive.7z (layout)
offset   bytes                                       part
0        37 7A BC AF 27 1C                           signature "7z" BC AF 27 1C
6        00 04                                       format version 0.4
8        F2 2C F2 AD                                 CRC-32 of the next 20 bytes
12       06 11 00 00 00 00 00 00                     next header offset: 4,358
20       23 00 00 00 00 00 00 00                     next header size: 35 bytes
28       E7 2C 4A 1A                                 CRC-32 of the next header
32       E0 13 D8 10 22 5D 00 1C …                   packed stream: 4,138 bytes,
                                                     all 5 files in one LZMA2 block
4,170    (220 bytes)                                 the real header, compressed
4,390    17                                          kEncodedHeader
4,391    06 90 2A 01 09 80 DC 00                     packed at 4,138, 220 bytes long
4,399    07 0B 01 00 01 23 03 01 01 05 5D …          coder 03 01 01: LZMA
4,414    0C 81 9A 0A 01 D7 E6 16 67 00 00            unpacks to 410 bytes; its CRC
4,425                                                end of file

The header, decompressed (410 bytes):
01 04                         kHeader, kMainStreamsInfo
06 00 01 09 90 2A 00          one packed stream: 4,138 bytes
07 0B 01 00 01 21 01 01       one folder, one coder: LZMA2 (21)
0C 93 D9                      the folder unpacks to 5,081 bytes
08 0D 05 09 82 EC 81 16 …     5 files in it: 748, 278, 530, 3,262 …
0A 01 36 18 74 C6 …           a CRC-32 for each file
05 09 0E …                    kFilesInfo: 9 entries, 4 of them empty
11 80 CF 00 64 00 61 00 …     names in UTF-16: "data", "docs" …
14 …  15 …                    modification times, attributes
  1. 137 7A BC AF 27 1C

    Signature

    The ASCII letters 7z and four bytes chosen to be unlikely in text. Every 7z file starts with them, which is how file and upload checks recognise it.

  2. 200 04

    Format version

    Major version 0, minor version 4, which is what current 7-Zip writes.

  3. 306 11 00 … · 23 00 …

    Pointer to the header

    The offset (4,358, counted from byte 32) and size (35 bytes) of the next header, with CRC-32 checksums for both this pointer and the header. A reader jumps straight there.

  4. 4E0 13 D8 10 22 5D …

    The packed stream

    All five files compressed together as one LZMA2 stream: 5,081 bytes in, 4,138 out. Most of that is the PNG, which was already compressed.

  5. 517 · 03 01 01

    An encoded header

    17 (kEncodedHeader) means the real table of contents is itself compressed, with LZMA (03 01 01). This keeps the header small even when an archive holds thousands of files.

  6. 607 0B … 21

    Folders and coders

    In 7z terms a folder is not a directory: it's one compressed block and the chain of coders that made it. Here there is one folder with one coder, LZMA2 (21). An encrypted archive adds AES (06 F1 07 01) to the chain.

  7. 708 0D 05 09 82 EC …

    Substreams

    How to cut the unpacked block back into files: five files, the first 748 bytes, the next 278, and so on, each with its own CRC-32.

  8. 811 80 CF 00 64 00 61 00

    File names

    Stored as UTF-16, so café-日本語.txt survives on every system. Folders are entries with no data, flagged as empty streams.

  9. 914 … 15 …

    Times and attributes

    Modification times as Windows FILETIME values (100-nanosecond steps since 1601) and attributes. 7-Zip on Linux also stores Unix permission bits here.

Compression

LZMA, LZMA2 and the other methods

LZMA (Lempel–Ziv–Markov chain algorithm) is Igor Pavlov's own method. It finds repeated sequences, like Deflate, but in a dictionary that can be up to 4 GB, then encodes the result with a range coder that adapts to the data. It compresses slowly and decompresses quickly, and decompression needs little memory beyond the dictionary.

LZMA2 wraps LZMA in chunks. Chunks that don't compress are stored as they are, and large inputs can be split across CPU threads. Current 7-Zip uses LZMA2 by default; 7zz l -slt shows it as LZMA2: followed by the dictionary size.

Methods 7-Zip can use inside a 7z file
MethodWhat it's for
LZMA2The default. Good for almost everything.
LZMAThe original default; still read everywhere.
PPMdOften better than LZMA on plain text, slower to decompress.
BZip2, DeflateOlder methods, for compatibility.
CopyNo compression, for data that won't shrink.
BCJ, BCJ2, ARM64 …Filters for executable code, applied before LZMA.
7zAESAES-256 encryption, as the last step in the chain.

The same algorithm in .xz

The xz format, common for Linux downloads (.tar.xz), uses LZMA2 too. It compresses a single stream, so it's paired with tar to hold many files.

Solid mode

Solid compression: smaller files, slower access

In a solid archive, files are joined end to end and compressed as one stream, called a block. When files look alike, such as logs, source code or documents in the same template, the compressor finds repeats across them and the archive gets much smaller. 7-Zip makes solid archives by default.

Our samples: the same 40 log files and a README (76,411 bytes)
FileModeSize
sample-solid.7zSolid, 1 block12,303 bytes
sample-non-solid.7zNon-solid, 41 blocks21,807 bytes

The trade-offs:

  • Extracting one file is slower. To reach a file near the end of a block, 7-Zip has to decompress everything before it in that block.
  • Damage spreads. A corrupted byte early in a block can make every later file in that block unrecoverable.
  • Updating is slower. Adding or deleting a file means recompressing the block.

7-Zip limits the damage by starting a new block every so often: the -ms switch sets the block size or the number of files per block, and -ms=off turns solid mode off. tar files compressed as a whole (.tar.gz, .tar.xz) are effectively one big solid block.

Security

Password protection and encrypted file names

7z encrypts with AES-256. The key comes from your password run through SHA-256 many times: our samples show 7zAES:19, meaning 2^19 (524,288) rounds, which makes each password guess slow. Two settings matter:

OptionWhat's encryptedWithout the password
Password only (-p)File contentsAnyone can list the names, sizes and dates. sample-encrypted.7z is like this.
Encrypt file names (-p -mhe=on)Contents and the headerNothing can be listed; 7-Zip asks for the password before showing anything. sample-encrypted-names.7z is like this.

Header encryption works because the whole table of contents is a stream like any other: 7-Zip compresses it, then encrypts it. In 7-Zip's Windows app it's the Encrypt file names box in the Add to Archive window. ZIP has no widely supported way to hide names, which is one reason people choose 7z for sensitive files.

Encryption is only as strong as the password

AES-256 can't be broken directly, but short or common passwords can be guessed offline, and tools exist that try millions. Use a long, random password. If you forget it, there is no recovery.

Comparison

7z vs ZIP vs RAR

7zZIPRAR
CompressionUsually the smallestGoodClose to 7z
Opens without extra softwareRecent Windows 11 onlyEverywhereRecent Windows 11 only
Create with free softwareYes (7-Zip, open source)YesNo: only RARLAB's paid WinRAR and RAR
EncryptionAES-256, can hide namesZipCrypto (weak) or AES-256; names always visibleAES-256 (RAR5), can hide names
Solid compressionYes, by defaultNoOptional
Damage repairNoNoRecovery records
Unix owners and permissionsPermissions onlyPermissions, if the tool stores themPermissions; owner and group with -ow

Use ZIP when you don't know what the recipient has. Use 7z when size matters, or you want names hidden, and the recipient can install 7-Zip. RAR does similar things but can only be created with paid software. For backups on Linux or macOS, prefer tar with xz or gzip: 7z doesn't record file owners and groups.

How to

How to open and create a 7z file

  • Windows 11: double-click to browse it, then Extract all. Support arrived in an update in late 2023, and version 24H2 added Compress to → 7z File. The built-in tool can't open password-protected archives; use 7-Zip for those, and for Windows 10.
  • macOS: use a free app such as Keka or The Unarchiver, or the official command-line 7zz from 7-zip.org.
  • Linux: 7z x archive.7z or 7zz x archive.7z to extract, 7z l to list, 7z a archive.7z folder to create, from your distribution's 7zip or p7zip package. Desktop archive managers such as File Roller and Ark open 7z files too.
  • Phone: use an archive app, such as ZArchiver on Android or an unarchiver app from the App Store on iPhone and iPad.
  • Programming: Python's py7zr and Java's Apache Commons Compress read and write 7z; libarchive reads it; Igor Pavlov's LZMA SDK has the LZMA code and a 7z decoder in C.

Useful 7-Zip switches: -mx=9 for maximum compression, -p to set a password, -mhe=on to encrypt names, -ms=off for a non-solid archive, -v100m to split into 100 MB parts (.7z.001, .7z.002 …).

Troubleshooting

Common 7z problems

  • "Cannot open the file as archive" or "Unexpected end of data": usually an incomplete download. Unlike ZIP, the table of contents is at the end, so a cut-off 7z can't even be listed. Download it again and compare the size.
  • Windows asks for a password it won't accept, or says the archive is invalid: the built-in tool doesn't support encrypted 7z files. Open it with 7-Zip.
  • Only .7z.001 opens, or nothing does: it's a split archive. Put all parts in one folder and open the .001 file with 7-Zip; every part must be present.
  • Extracting one small file takes ages: the archive is solid and the file sits late in a big block. Nothing is wrong; recreate it with smaller blocks if you do this often.
  • "Unsupported method": the archive uses a method or filter your tool doesn't know, often from a newer 7-Zip. Update 7-Zip, or ask for a ZIP.

Security

Is it safe to open a 7z file?

7z files carry the same risks as any archive. Listing one is safe; the risk is in what's inside and in how it's extracted.

  • Malware past filters. Attackers like encrypted 7z files, especially with hidden names: a mail scanner can't see inside, and can't even see that there's an .exe.
  • Path traversal. An entry named with ../ or an absolute path can write outside the target folder. Mainstream extractors strip or refuse such names; your own extraction code must check them, as with ZIP.
  • Decompression bombs. A small 7z can expand to a huge size, and solid LZMA2 compresses repetitive data extremely well. Cap the output size when extracting untrusted archives.
  • Bugs in the extractor. 7-Zip has had security flaws. CVE-2025-0411, fixed in 7-Zip 24.09 (November 2024), let files from an archive nested inside another skip Windows' Mark-of-the-Web warning, and was used in real attacks. CVE-2025-11001, fixed in 25.00, let crafted ZIP files with symbolic links write outside the target folder. Keep 7-Zip updated: most releases since 2024 list fixes.

Free downloads

Sample 7z files to download

Free sample 7z archives for testing extractors, upload validation and parsers. They were made with the official 7-Zip 26.05 console build and tested with both 7zz t and the independent Python reader py7zr. The password for the encrypted ones is 99helpers.

sample-archive.7z · 4.3 KBDownload

Browsers can't show this kind of file in a page. Download it to open it in the app it belongs to.

What's inside sample-archive.7z

A small archive with the features you'll meet in real 7z files, in 4.4 KB. Browsers can't show what's inside an archive, so there's no live preview; its README.txt describes the contents.

  1. Folders

    docs/, data/, images/ and unicode/ are entries of their own, marked as empty streams with the directory attribute.

  2. One solid LZMA2 block

    All five files are compressed together: 5,081 bytes in, 4,138 out. 7zz l -slt shows Solid = + and Blocks = 1.

  3. A compressed header

    The 410-byte table of contents is stored LZMA-compressed in 220 bytes, behind a 35-byte encoded-header record at the end.

  4. A UTF-8-safe name

    unicode/café-日本語.txt is stored as UTF-16 in the header. If it extracts with a garbled name, the tool is mishandling names.

  5. An already-compressed file

    images/logo.png barely shrinks; it's most of the archive's size. Compressed formats such as PNG, JPG and MP4 gain little from any archiver.

  6. Fixed dates and permissions

    Every entry is dated 2026-10-27 12:00:00 UTC and carries Unix permissions (644 for files, 755 for folders).

All sample 7Z files

  • Sample archive with folders

    sample-archive.7z · 4.3 KB (4,425 bytes)

    9 entries: four folders, text files, a PNG and a non-ASCII file name, in one solid LZMA2 block with a compressed header.

    • Testing extraction, listing and previews
    • Checking Unicode file names
  • Password-protected 7z, names visible

    sample-encrypted.7z · 472 bytes

    Two files and a folder, AES-256 encrypted. Password: 99helpers. The file list can be read without the password.

    • Password prompts and wrong-password errors
    • Upload filters that should flag encrypted archives
  • Password-protected 7z, names hidden

    sample-encrypted-names.7z · 511 bytes

    The same files with header encryption (-mhe=on). Password: 99helpers. Nothing can be listed without it.

    • Checking how a scanner or uploader reports an archive it can't list
    • Testing header decryption in libraries
  • Solid archive, 41 similar files

    sample-solid.7z · 12.0 KB (12,303 bytes)

    40 small log files and a README (76,411 bytes) in a single LZMA2 block.

    • Comparing with the non-solid version
    • Measuring single-file extraction from a solid block
  • Non-solid archive, same files

    sample-non-solid.7z · 21.3 KB (21,807 bytes)

    The same 41 files with solid mode off (-ms=off): 41 blocks, one per file, and 77% bigger.

    • Showing what solid compression saves
    • Libraries that only handle one file per block
  • 100 KB 7z file

    sample-100kb.7z · 100 KB (102,400 bytes)

    A README and a file of pseudo-random data stored with the Copy method (no compression), sized so the archive is exactly 102,400 bytes.

    • Upload and size-limit tests
    • Tools that must handle the Copy method

Ways to test with them

  • Extraction and names: extract sample-archive.7z and check you get four folders and café-日本語.txt with its name intact.
  • Encryption: open both encrypted samples with 99helpers. A tool that lists sample-encrypted.7z without asking but fails on sample-encrypted-names.7z before the password prompt doesn't support header encryption.
  • File type detection: all six start with 37 7A BC AF 27 1C. Check your upload filter accepts them by content, not just by the .7z extension.
  • Solid vs non-solid: compare the two log archives' sizes, and time how long your tool takes to pull out logs/day-40.log from each.
  • Upload limits: sample-100kb.7z is exactly 102,400 bytes, so you can test a limit at the boundary.

Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.

Put it online

Have a 7z file? Give it a link.

Drop a 7z archive on 99helpers and it gets its own download link, so you can share a large set of files without attachment limits. Anyone with the link downloads the archive and extracts it with their own tools.

Questions

7Z files, frequently asked

How do I open a 7z file?

On Windows 11, double-click it: File Explorer opens 7z files since a late-2023 update, though not password-protected ones. Otherwise use 7-Zip on Windows, Keka or The Unarchiver on a Mac, or 7z x file.7z on Linux.

Is 7z better than ZIP?

It usually compresses better and can encrypt file names, so it's better for size and privacy. ZIP is better for compatibility: every system opens it without extra software.

Is 7-Zip free?

Yes. 7-Zip is free and open source, mostly under the GNU LGPL, including for commercial use. The 7z format has no licence restrictions.

Why is my 7z file not much smaller than the original?

The files were already compressed. Photos, videos, MP3s, PDFs, Office files and other archives gain little from any archiver.

Can a 7z file have a virus?

It can contain any file, including malware, and encrypted 7z files are popular for slipping malware past email scanners. Opening the archive to look is safe; be careful running anything inside, and keep 7-Zip updated.

How do I password-protect a 7z file?

In 7-Zip, choose Add to archive, pick 7z, enter a password and tick Encrypt file names. On the command line: 7z a -p -mhe=on secret.7z folder. 7-Zip uses AES-256.

What is a .7z.001 file?

The first part of a 7z archive split into volumes. Put all the parts in one folder and open the .001 file with 7-Zip; it joins them as it extracts.

Can a 7z file be opened on a phone?

Yes, with an archive app: ZArchiver and similar apps on Android, or an unarchiver app from the App Store on iPhone and iPad.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.