{
  "schemaVersion": 1,
  "contentVersion": "ca42e61ede0a24f789d7287a0001244ad22f4abf",
  "id": "docs/codecs/data/zip",
  "collection": "docs",
  "title": "ZIP",
  "description": "ZIP is the universal archive format: every OS opens it, each file is compressed separately, and it supports DEFLATE plus newer methods that not every tool can read.",
  "canonicalUrl": "https://encode.wiki/codecs/data/zip/",
  "apiUrl": "https://encode.wiki/api/v1/documents/docs/codecs/data/zip.json",
  "markdownUrl": "https://encode.wiki/api/v1/markdown/docs/codecs/data/zip.md",
  "status": "current",
  "tags": [
    "migrated"
  ],
  "license": "CC BY-SA 4.0",
  "dates": {
    "lastVerified": "2026-10-08T00:00:00.000Z"
  },
  "authors": [],
  "sources": [
    {
      "title": "PKWARE ZIP File Format Specification (APPNOTE)",
      "url": "https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "Info-ZIP",
      "url": "https://infozip.sourceforge.net/Zip.html",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "7-Zip",
      "url": "https://7-zip.org/7z.html",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    }
  ],
  "provenance": {
    "originUrl": "https://github.com/av1-community-contributors/codec-wiki/blob/37c3317fd058b23c71a87679bed5619a98f77752/docs/data/zip.mdx",
    "originCommit": "37c3317fd058b23c71a87679bed5619a98f77752",
    "migratedAt": "2026-08-21T00:00:00.000Z",
    "modified": true,
    "originPath": "docs/data/zip.mdx"
  },
  "headings": [
    {
      "depth": 2,
      "text": "Common commands",
      "anchor": "common-commands"
    },
    {
      "depth": 2,
      "text": "Compression methods",
      "anchor": "compression-methods"
    },
    {
      "depth": 2,
      "text": "Encryption and limits",
      "anchor": "encryption-and-limits"
    }
  ],
  "sections": [
    {
      "id": "_preamble",
      "title": "Page introduction",
      "depth": 0,
      "canonicalUrl": "https://encode.wiki/codecs/data/zip/",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/data/zip/_preamble.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/data/zip/_preamble.md",
      "checksum": "3f4a3a648a059d6c3073d31c5107862eeeccab10be69aa532c1ec6a54a84524b",
      "bytes": 516
    },
    {
      "id": "common-commands",
      "title": "Common commands",
      "depth": 2,
      "anchor": "common-commands",
      "canonicalUrl": "https://encode.wiki/codecs/data/zip/#common-commands",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/data/zip/common-commands.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/data/zip/common-commands.md",
      "checksum": "513d72fde86404c91703b4f4a7b440e692fcdef14c2d5f2b2eff60a5f3b40a4f",
      "bytes": 701
    },
    {
      "id": "compression-methods",
      "title": "Compression methods",
      "depth": 2,
      "anchor": "compression-methods",
      "canonicalUrl": "https://encode.wiki/codecs/data/zip/#compression-methods",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/data/zip/compression-methods.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/data/zip/compression-methods.md",
      "checksum": "53e7dd728fea0492d07a51735c003fbb3e59eebfeec99c61a7e4b6c6c58cca6f",
      "bytes": 982
    },
    {
      "id": "encryption-and-limits",
      "title": "Encryption and limits",
      "depth": 2,
      "anchor": "encryption-and-limits",
      "canonicalUrl": "https://encode.wiki/codecs/data/zip/#encryption-and-limits",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/data/zip/encryption-and-limits.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/data/zip/encryption-and-limits.md",
      "checksum": "df752a84a20a3612b1d92784db57d9d2c96befb661a6919fb5f23376eff70e6c",
      "bytes": 742
    }
  ],
  "outboundReferences": [
    "/codecs/data/7z/",
    "/codecs/data/tar/"
  ],
  "checksum": "c5e214ac78213f167063e617bac6aca28cbaf40539f4ab275f98410d41b9871b",
  "contentFormat": "markdown",
  "markdown": "ZIP is an archive format: one file holding many entries, each compressed on its own and listed in a central directory at the end. That makes extracting a single file fast and appending cheap, and every operating system opens `.zip` natively. The price is a weaker ratio than [7z](/codecs/data/7z/) or `.tar.xz`, because entries are compressed independently (no shared dictionary across files). Use ZIP when the recipient might be anyone; also remember that `.docx`, `.jar`, `.apk`, `.epub` and `.cbz` are ZIP files.\n\n## Common commands\n\n```sh\nzip -r archive.zip dir/              # Deflate, recurse\nzip -r -9 archive.zip dir/ -x '*.tmp'   # best Deflate, exclude pattern\nzip -r -y archive.zip dir/           # store symlinks as links\nunzip -l archive.zip                 # list\nunzip -t archive.zip                 # test\nunzip archive.zip -d out/            # extract into out/\n```\n\nRunning `zip` on an existing archive adds and replaces entries (`-u` only updates changed ones); `-0` stores without compression, which is the right choice for already-compressed content such as video or JPEGs. The Info-ZIP `zip`/`unzip` tools are on most Linux systems; macOS and Windows ship their own, and `7z a -tzip` also works.\n\n## Compression methods\n\nThe default is Deflate (method 8), and that is the only one you can count on everywhere. The format also defines others, which built-in OS tools and Info-ZIP `unzip` often cannot read:\n\n| Method         | Notes                                                                 |\n| -------------- | --------------------------------------------------------------------- |\n| Deflate        | Universal; the default                                                |\n| Deflate64      | Larger window variant; 7-Zip writes it, Info-ZIP `unzip` 6.0 reads it |\n| bzip2          | `zip -Z bzip2` or 7-Zip; `unzip` 6.0 reads it                         |\n| LZMA, xz, PPMd | 7-Zip and similar tools only; `unzip` 6.0 skips these entries         |\n| Zstandard (93) | Added in APPNOTE 6.3.8; 7-Zip 24.01+ can read it                      |\n\nFor anything but Deflate, check that the other side's tool supports it. If you want better compression, use 7z or `.tar.zst` instead.\n\n## Encryption and limits\n\n- **Classic ZipCrypto** (`zip -e`) is weak and can be broken with known plaintext. AES-256 ZIP (`7z a -tzip -mem=AES256 -p`) is secure but unreadable to Info-ZIP `unzip` and to some built-in OS tools. File names stay readable either way.\n- **ZIP64** removes the old 4 GiB and 65,535-entry limits; current tools write it automatically when needed. Very old extractors may not read it.\n- **Metadata:** ZIP stores modification time and basic permissions but not Unix owner/group or xattrs. For system backups use [tar](/codecs/data/tar/).\n- **File names:** non-ASCII names are the usual cross-platform problem. Modern tools write UTF-8 names with the correct flag; older ones use the local code page and show mojibake.\n"
}
