ZIP file signature
Magic number at the start of the file · PK..
The ZIP local file header PK\x03\x04 (the PK is for Phil Katz) starts an enormous family of formats. Office files (DOCX, XLSX, PPTX), EPUB books, Android APKs, OpenDocument files and Java JARs are all ZIP archives underneath, so a file that starts with PK is almost always a ZIP or one of these.
What this magic number means
A magic number is a short, fixed run of bytes at a known position that tells a program what a file really is, no matter what the filename says. If a file starts with the bytes 50 4B 03 04 (the text PK..), it is a ZIP file.
An empty ZIP starts PK\x05\x06 and a spanned archive PK\x07\x08. Inside an EPUB the first entry is an uncompressed mimetype file, which is how readers confirm it after the PK header.
If your file starts with the bytes 50 4B (the letters PK), it is a ZIP container. What kind depends on the entry names inside, for example [Content_Types].xml for Office or AndroidManifest.xml for an APK.
Signature variants
ZIP appears with more than one byte pattern. These all identify the same family:
| Hex signature | Offset | Note |
|---|---|---|
| 50 4B 03 04 | 0 | normal archive with entries |
| 50 4B 05 06 | 0 | empty archive (end-of-central-directory only) |
| 50 4B 07 08 | 0 | spanned / split archive |
Formats that use the 50 4B 03 04 signature
These file types in our database carry this signature:
It is also seen in: KMZ.
How to check a file's signature
You can read the first bytes of any file yourself. The magic bytes are shown in hex, the same way this page lists them.
Linux & macOS
- xxd -l 16 example.zip
- hexdump -C -n 16 example.zip
- file example.zip
Windows (PowerShell)
- Format-Hex -Path example.zip -Count 16
Python
- open("example.zip","rb").read(4).hex()
In your browser
- Drop the file into the WhatFileType identifier, which reads the signature without uploading it.
Frequently asked questions
What is the ZIP file signature?
ZIP files start with the hex bytes 50 4B 03 04 (PK.. in ASCII). This magic number identifies the format regardless of the file's name or extension.
How do I check a file's magic number?
Open the file in a hex editor, or run a command such as xxd -l 16 example.zip on Linux or macOS, or Format-Hex -Path example.zip -Count 16 in Windows PowerShell, and read the first bytes.
Can a file fake the ZIP signature?
Renaming a file does not change its bytes, so the extension can lie but the signature usually cannot. A genuine ZIP file has these exact bytes; a file with the wrong bytes is not really ZIP, whatever its name says.