What is the MIME type of .7z files?
The MIME type (media type) for 7-Zip archive files with the .7z extension is application/x-7z-compressed. Already compressed archive format.
Content-Type header
Content-Type: application/x-7z-compressed
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | application/x-7z-compressed 7z; |
Apache (.htaccess) | AddType application/x-7z-compressed .7z |
IIS (web.config) | <mimeMap fileExtension=".7z" mimeType="application/x-7z-compressed" /> |
| Node.js / Express | res.type('7z') or res.setHeader('Content-Type', 'application/x-7z-compressed') |
| Amazon S3 | Set Content-Type: application/x-7z-compressed on the object (metadata), or pass --content-type application/x-7z-compressed to aws s3 cp |
Should .7z files be compressed?
No. 7-Zip archive files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave application/x-7z-compressed out of your compression configuration.
Why the MIME type matters
Browsers decide what to do with a response — render, run, play or download — from the Content-Type header, not the file extension. With X-Content-Type-Options: nosniff, a wrong type causes stylesheets and scripts to be blocked outright. For uploads, never trust the type sent by the client; check the file’s content (its magic bytes) on the server.
Frequently asked questions
What is the MIME type for .7z?
application/x-7z-compressed.How do I set the Content-Type for .7z in Nginx?
application/x-7z-compressed 7z; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.