DevToolsmith

ZIP MIME Type

application/zip is the MIME type for ZIP archives. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
application/zip
Extensions
.zip
Content-Type header
application/zip
Registered
Yes, with IANA
Compress with gzip
No, it is already compressed
Category
Archives

About ZIP archive files

Windows browsers often report ZIP uploads as application/x-zip-compressed, so accept both. Many other formats are ZIP files underneath: .docx, .xlsx, .pptx, .odt, .epub, .jar and .apk all start with the same PK bytes, so a signature check alone can’t tell them apart.

  • When extracting uploaded ZIPs on a server, check every entry’s path for ../ (“zip slip”) and limit the total uncompressed size to guard against zip bombs.

Other types seen for these files: application/x-zip-compressed , application/x-zip . Accept them when reading uploads, but send application/zip yourself.

File signature

ZIP files start with 50 4B 03 04 ("PK"); 50 4B 05 06 for an empty archive. The extension and the type a browser reports for an upload both come from the file name, so check these bytes on the server before trusting a file.

Serve .zip with the right Content-Type

Response header
Content-Type: application/zip
nginx (a line in the types { } block of mime.types)
application/zip zip;
Apache (.htaccess or server config)
AddType application/zip .zip
Caddy
@zip path *.zip
header @zip Content-Type "application/zip"
Check what a server sends
curl -sI https://example.com/file.zip | grep -i '^content-type'
# Content-Type: application/zip

Set the type in code

Node.js (Express)
res.set('Content-Type', 'application/zip');
// Or make the browser download it:
res.attachment('file.zip');
Python
import mimetypes

mimetypes.add_type('application/zip', '.zip')  # if your system doesn't know it
mimetypes.guess_type('file.zip')[0]  # 'application/zip'
Go
mime.AddExtensionType(".zip", "application/zip")
w.Header().Set("Content-Type", "application/zip")

Accept .zip uploads

HTML
<input type="file" accept=".zip,application/zip">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .gz (application/gzip): Gzip file
  • .7z (application/x-7z-compressed): 7-Zip archive
  • .rar (application/vnd.rar): RAR archive
  • .tar (application/x-tar): Tar archive

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .zip files?

application/zip. You may also see application/x-zip-compressed, application/x-zip, which are older or unofficial; send application/zip. The full header is "Content-Type: application/zip".

Why does my server send the wrong Content-Type for .zip?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .zip is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is ZIP?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. ZIP files start with 50 4B 03 04 ("PK"); 50 4B 05 06 for an empty archive. The MIME type lookup on this site reads them for you when you drop a file on it.