file in abyss
Back to formats

Archive

ZIP ZIP Archive

ZIP Archive is a archive format commonly identified by .zip. Use the listed signatures, MIME types, and structure notes to validate files beyond the extension.

Extensions .zip
MIME application/zip

Magic numbers

Analyze your file
offset 0 ZIP Archive leading signature
50 4B 03 04
PK..
offset 0 ZIP Archive leading signature
50 4B 05 06
PK..
offset 0 ZIP Archive leading signature
50 4B 07 08
PK..

Structure

  1. Local file headers
  2. Compressed file data
  3. Central directory
  4. End of central directory

Caveats

  • Do not trust the extension alone. Check the MIME type, the first bytes such as 50 4B 03 04, and format-specific structure when possible.
  • Container formats and damaged files can share the same opening bytes, so deeper validation may be required for production upload, preview, or conversion flows.

Detection example

SIGNATURE = bytes.fromhex("504b0304")
OFFSET = 0

def is_zip(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

Practical usage

Use cases

ZIP Archive is used for compression, extraction, backups, attachments, and multi-file inspection. Validate paths, file counts, compressed size, and extracted size before unpacking.

Common detection mistakes

  • The .zip extension alone does not prove the file contents. Upload and conversion flows should combine extension, MIME type, leading bytes, and format-specific structure checks.
  • ZIP Archive can start with signatures such as 50 4B 03 04 or 50 4B 05 06 or 50 4B 07 08, but related containers and damaged files may require additional validation.

Security notes

Archives can contain zip-slip paths, excessive expansion, hidden files, and double extensions. Normalize extraction paths and enforce file count and size limits.

Using samples

11 samples help test leading-byte detection, parser errors, upload limits, and download behavior.

Sample files

11 / 11 files
Sample Traits Size Source / license / SHA-256
Arc

Single-file ZIP

Single-file ZIP is a ZIP Archive sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

single-file.zip
Type Sample
Small file
130 B
Generated CC0 1.0
SHA-256 bdd0e789d32b3d771dda6614fe1c43ae23da8c5490d1f603b0f76c03aa66d10f
Download
Arc

Empty ZIP

Empty ZIP is a ZIP Archive sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

empty.zip
Type Sample
Small file
22 B
Generated CC0 1.0
SHA-256 8739c76e681f900923b900c9df0ef75cf421d39cabb54650c4b9ad19b6a76d85
Download
Arc

Two File ZIP

Two File ZIP is a ZIP Archive sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

two-files.zip
Type Sample
Small file
264 B
Generated CC0 1.0
SHA-256 5147699c1713b7d5d9d32bc88baf5fe5d82f7cd33305e70ff885be3c7e91c827
Download
Arc

Blue Sky ZIP

Blue Sky ZIP is a ZIP Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.zip
Type Sample
Small file
675 B
SHA-256 406899035ac2a5ebd7641aaf09b0026caf34ae6414f224801a2df79888baab21
Download
Arc

Flower Garden ZIP

Flower Garden ZIP is a ZIP Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.zip
Type Sample
1.2 KB
SHA-256 9ff8454befd465893ed4f21427fb53aff3b830d7501e125445d32b27e6d71477
Download
Arc

Navy Blue Sky ZIP

Navy Blue Sky ZIP is a ZIP Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.zip
Type Sample
1.6 KB
SHA-256 821a889e4ca078ef99efa381eaf06128e7859bf439ee3eb53f099eea43af5b13
Download
Arc

Nature of the Sky ZIP

Nature of the Sky ZIP is a ZIP Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.zip
Type Sample
2.1 KB
SHA-256 4b7eef406dfa9120a46e419abf15f8d5fdd4b59f82e41548e895b3859d1c81ee
Download
Arc

Sky Landscape ZIP

Sky Landscape ZIP is a ZIP Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.zip
Type Sample
2.9 KB
SHA-256 1efa3a18f71d6235167237cdc8611dbacd9812b6aac86d5fdac2e87843a0a96f
Download
Arc

Starry Sky ZIP

Starry Sky ZIP is a ZIP Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.zip
Type Sample
2.9 KB
SHA-256 9dea35b1174a734275f911257297b00a3f7269459b6f99becfc061f3e4cfeed1
Download
Arc

Blue Night Sky ZIP

Blue Night Sky ZIP is a ZIP Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.zip
Type Sample
3.7 KB
SHA-256 ae59106122a39caf2142ab9cb6947522d55b5afeba9d8d89fa63d5801fcb752b
Download
Arc

NASA Blue Marble ZIP

NASA Blue Marble ZIP is a ZIP Archive sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.

nasa-blue-marble-2012-east.zip
Type Sample
10 KB
SHA-256 527dd0ee5ce84bfea705fa242f5a9bd38c951d91f9c2c37f79ab8766612530db
Download

Frequently asked questions

What is the magic number (file signature) of ZIP Archive?

ZIP Archive files begin with the byte signature 50 4B 03 04 ("PK..") or 50 4B 05 06 ("PK..") or 50 4B 07 08 ("PK.."). Detect the format by reading these leading bytes rather than trusting the file extension alone.

What is the MIME type of ZIP Archive?

The MIME type for ZIP Archive is application/zip.

What file extension does ZIP Archive use?

ZIP Archive files use the .zip extension. The extension is a convention only and does not guarantee the file contents, so combine it with signature and structure checks.

Related formats