A ZIP file is a single file that contains other files and folders, usually compressed so the whole bundle takes less space. It is the most widely supported archive format there is: Windows, macOS, Linux, iOS and Android can all open ZIP files without extra software.
What a ZIP file does
A ZIP archive does two jobs. It bundles: many files and folders become one file that is easy to email, download or back up. And it can compress: repeated patterns in the data are encoded more efficiently, so the archive is often smaller than the files inside it.
ZIP was created by Phil Katz for PKZIP in 1989, and its specification, PKWARE's APPNOTE, has been public ever since. That openness is a big part of why it became the default archive format almost everywhere.
File types that are secretly ZIP files
Many file types you use every day are ZIP archives with a different extension:
.docx,.xlsx,.pptx: Microsoft Office documents.odt,.ods,.odp: OpenDocument files from LibreOffice.epub: e-books.jar,.apk,.ipa: Java, Android and iOS apps.xpi: Firefox extensions
This is why zipping a DOCX file barely changes its size: it is already compressed. You can even open these files in ZIP Viewer to see the XML and images inside.
Inside a ZIP file
| Part | What it holds |
|---|---|
| Local file header | Starts each file: the signature PK\x03\x04, the name, compression method, timestamp, CRC-32 and sizes. |
| File data | The file's bytes, stored as they are or compressed, and optionally encrypted. |
| Data descriptor (optional) | CRC and sizes written after the data, used when a tool streams a file and does not know them in advance. |
| Central directory | The index near the end: one record per entry with its name, sizes, method, attributes and where its data starts. |
| End of central directory | The last bytes of the file: where the central directory is, how many entries there are, and an optional archive comment. |
Readers start at the end, find the central directory and use it to jump straight to any file. That is why a ZIP viewer can list a huge archive quickly, and why a ZIP whose last few bytes are missing, after an interrupted download for example, often refuses to open even though most of the data is there. Repair ZIP works around that by scanning for the local headers instead.
How ZIP compression works
Most ZIP files use Deflate. It replaces repeated sequences of bytes with short references to an earlier copy, then encodes the result with Huffman codes so that frequent symbols take fewer bits. It is lossless: extraction gives back exactly the original bytes.
Each file is compressed separately. That lets you extract one file without decompressing the rest and keeps damage contained to the affected file, but it means ZIP cannot exploit similarities between files the way solid formats such as 7z or .tar.gz can.
| Method | ID | Notes |
|---|---|---|
| Store | 0 | No compression. Used for already-compressed files. |
| Deflate | 8 | The standard method. Opens everywhere. |
| Deflate64 | 9 | Deflate with a larger window; limited support. |
| BZIP2, LZMA, Zstandard, XZ, PPMd | 12, 14, 93, 95, 98 | Higher ratios, but only some apps such as 7-Zip or WinZip can open them. WinZip calls archives that use them .zipx. |
Aback ZIP creates Store and Deflate entries, which virtually all ZIP tools can read. It can also extract entries compressed with BZIP2, LZMA, XZ or Zstandard; Deflate64 and PPMd entries are listed in ZIP Viewer but are not decompressed.
Why some files do not shrink
Compression works by removing redundancy, and many common formats have already had theirs removed:
- JPEG, PNG, WebP and HEIC images
- MP4, MOV, MP3 and AAC media
- PDF documents, especially ones full of images
- DOCX, XLSX and PPTX files, which are ZIP archives themselves
- Existing ZIP, 7z and RAR archives
Compressing these again is like vacuum-packing something that is already vacuum-packed: it adds a little overhead and rarely saves anything. Good ZIP tools store such files without compression instead.
Checksums, encryption and size limits
Every entry records a CRC-32 checksum of its original contents. After extracting, a reader recomputes it; a mismatch means the data is damaged. CRC-32 reliably catches accidental corruption, but it is not a security feature, because anyone can change a file and its CRC together.
ZIP can encrypt file contents with a password, using the old ZipCrypto scheme or AES. File names stay readable either way. See ZIP encryption: AES vs ZipCrypto.
Classic ZIP fields are 32-bit, which caps files and archives at 4 GB and the number of entries at 65,535. The ZIP64 extension lifts those limits; see ZIP64 explained.