Skip to content
SimpleTools24

What Is a 7z File? The 7-Zip Format Explained

By SimpleTools24Published 4 min read

A 7z file is a compressed archive in the 7z format, which Igor Pavlov created for his free archiver 7-Zip in 1999. Like ZIP or RAR, it packs files and folders into one smaller file, but it's known for particularly high compression, mainly thanks to the LZMA and LZMA2 methods. The format is open: its specification and compression code are publicly available, so any developer can support it.

This guide explains what's going on inside a .7z file and what that means when you create or open one.

How a 7z Archive Is Organised

Every 7z file begins with a fixed six-byte signature, 37 7A BC AF 27 1C, which starts with the ASCII characters 7z. After that come:

  • A start header pointing to where the main header lives (at the end of the file).
  • Packed streams: the compressed data.
  • A header describing every file: names, sizes, timestamps, attributes, CRC checksums, and how the packed streams decode.

Storing the header at the end lets 7-Zip write the archive in one pass. It's also why a truncated 7z download often can't be opened at all: if the end is missing, so is the file list. That's a common cause of errors covered in fixing "Cannot open file as archive".

Compression Methods

The 7z container can hold data compressed with several methods. The main ones:

Compression methods used in 7z archives
MethodWhat it's good atNotes
LZMA2General purpose, the defaultMulti-threaded; handles incompressible data efficiently
LZMAGeneral purposeThe original method; single stream
PPMdPlain textCan beat LZMA on text, slower to decompress
BZip2CompatibilityOlder, usually weaker than LZMA2
DeflateCompatibilityThe same family as ZIP's default
CopyAlready-compressed dataStores files without compressing

What LZMA Does Differently

LZMA (Lempel–Ziv–Markov chain algorithm) replaces repeated sequences with references to earlier data, then encodes the result with a range coder that models probabilities very precisely. Its key strength is a large dictionary, the window of previous data it can look back into. ZIP's Deflate looks back only 32 KB; LZMA dictionaries are measured in megabytes or more, so it finds repeats that are far apart in the input.

LZMA2 wraps LZMA in chunks. That lets 7-Zip compress with several CPU threads and store blocks that don't compress (like JPEGs) without wasting effort.

Filters

Before compression, 7-Zip can run filters that make data more compressible. BCJ and BCJ2 convert addresses in x86 executable code so repeated calls look identical, and a delta filter helps with some audio and image data. You don't need to choose these; 7-Zip applies them automatically for suitable files.

Solid Compression

By default, 7-Zip creates solid archives: many files are compressed together as one stream, so similarities between files are exploited. A folder of similar source files or documents can compress far better this way.

There are two costs:

  • Extracting one file from the middle of a solid block means decompressing everything before it in that block.
  • Damage to one part of a solid block can make the rest of that block unreadable.

7-Zip can split data into several solid blocks to limit both effects.

Encryption

7z uses AES-256 encryption, with the key derived from your password through many rounds of SHA-256, which slows down guessing attacks.

There's also an option to encrypt file names (header encryption). Without it, anyone can list the files in an encrypted archive; with it, the archive reveals nothing until the right password is entered. If privacy of the file list matters, turn it on when creating the archive.

Where Else You'll Meet the 7z Format

The format turns up in places that don't end in .7z:

  • Self-extracting archives. 7-Zip can attach a small extractor to a 7z archive, producing an .exe that unpacks itself on Windows. Many software installers work this way.
  • Comic book archives. A .cb7 file is simply a 7z archive of page images, read by comic viewers.
  • LZMA inside other formats. The .xz format used by many Linux packages (and .tar.xz source archives) uses LZMA2 compression, but in a different container, so it isn't a 7z file even though it shares the method.

If you need to check what a file really is, the first six bytes settle it: only genuine 7z archives start with 37 7A BC AF 27 1C.

Why Use 7z?

7z makes sense when:

  • You care about the smallest possible archive, especially for text, code, logs or databases.
  • You want strong, standard encryption that also hides file names.
  • You're archiving for yourself or for technical recipients who have an extractor.

It's less suitable when recipients just double-click and expect things to open, because macOS and older Windows can't open 7z without an app. That trade-off is compared in detail in 7z vs ZIP. For the proprietary alternative with similar goals, see what a RAR file is.

Opening a 7z File

You'll need 7-Zip, Keka, The Unarchiver, PeaZip or another compatible extractor, or a recent Windows 11 build. Instructions for every platform are in how to open 7z files. If you'd like to look inside without installing anything, you can inspect a 7z archive online: it shows the compression method, whether the archive is solid and whether it's encrypted, before you extract a single file.

Frequently Asked Questions

Is 7z lossless?

Yes. Every file extracted from a 7z archive is identical to the original, byte for byte.

Is 7z better than RAR?

They're close. Both offer strong compression and AES encryption. 7z is an open format with free tools for creating archives; RAR adds recovery records but needs WinRAR to create.

What does the compression level change?

Higher levels use bigger dictionaries and slower match searches for smaller files. "Ultra" can need a lot of memory to compress, and somewhat more to decompress, than "Normal".

Can a 7z file contain a virus?

It can contain any file, including malware. The format itself doesn't run anything, so inspect the contents before opening executables.

Takeaway

7z is an open, highly efficient archive format built around LZMA2, solid compression and AES-256. It's ideal for compact archives and backups, with the caveat that recipients need a 7z-capable extractor.

Sources