Skip to main content
The 7z format is a modern archive format that provides high compression ratios and advanced features.

Format Overview

From DOC/7zFormat.txt:
7z archive can contain files compressed with any method. The format supports:
  • Solid compression
  • Multiple compression methods
  • Strong AES-256 encryption
  • Large file support (16 EB limit)
  • Unicode filenames
  • File attributes and timestamps

Archive Structure

A 7z archive consists of:

Signature Header

From 7z.h (lines 11-14):
Structure (32 bytes):

Header Types

From DOC/7zFormat.txt (lines 100-150):

Compression Methods

From DOC/Methods.txt, method IDs:

Common Methods

Filters

Folder Structure

From 7z.h (lines 42-51):
A folder represents a compression unit:
  • Can contain multiple files (solid compression)
  • Defines the compression method chain
  • Stores coder properties

Coder Information

From 7z.h (lines 24-30):

File Information

File Item

From 7z.h (lines 56-66):

File Attributes

Windows attributes:
Unix attributes (stored in high 16 bits):

Encryption

7zAES

Method ID: 06 F1 07 01 From DOC/Methods.txt (lines 172-173):
Properties structure:
Key derivation:
  1. Concatenate: Password + Salt
  2. Hash with SHA-256, repeated 2^NumCycles times
  3. Result: 32-byte AES key

Header Encryption

When -mhe=on is used:
  1. Archive headers are compressed
  2. Compressed headers are encrypted with AES-256
  3. Only signature header remains unencrypted
  4. Password required to list files

Archive Database

From 7z.h (lines 79-96):

Format Limits

Reading 7z Archives

Opening Archive

From DOC/7zC.txt (lines 93-107):

Extracting Files

Creating 7z Archives

Archive Handler

From CPP/7zip/Archive/7z/7zHandler.h:

Update Operations

Format Advantages

High Compression

LZMA2 provides excellent compression ratios

Solid Compression

Compress similar files together for better ratios

Strong Encryption

AES-256 encryption with SHA-256 key derivation

Large File Support

Support for files and archives up to 16 EB

Unicode Names

Full Unicode support for filenames

Extensible

Support for custom compression methods

Format Comparison

Implementation Files

Key source files:
  • Format handler: CPP/7zip/Archive/7z/7zHandler.cpp
  • Archive reader: C/7zArcIn.c
  • Decoder: C/7zDec.c
  • Header structures: C/7z.h
  • Format constants: CPP/7zip/Archive/7z/7zHeader.h

Format Documentation

Complete format specification:
  • DOC/7zFormat.txt - Full format specification
  • DOC/Methods.txt - Compression method IDs
  • DOC/7zC.txt - ANSI-C decoder documentation

See Also