What is the MIME type of .rar files?
The MIME type (media type) for RAR archive files with the .rar extension is application/vnd.rar. You may also see application/x-rar-compressed. Registered as application/vnd.rar; older systems use application/x-rar-compressed.
Content-Type header
Content-Type: application/vnd.rar
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | application/vnd.rar rar; |
Apache (.htaccess) | AddType application/vnd.rar .rar |
IIS (web.config) | <mimeMap fileExtension=".rar" mimeType="application/vnd.rar" /> |
| Node.js / Express | res.type('rar') or res.setHeader('Content-Type', 'application/vnd.rar') |
| Amazon S3 | Set Content-Type: application/vnd.rar on the object (metadata), or pass --content-type application/vnd.rar to aws s3 cp |
Should .rar files be compressed?
No. RAR archive files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave application/vnd.rar 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 .rar?
application/vnd.rar. Alternatives seen in the wild: application/x-rar-compressed.How do I set the Content-Type for .rar in Nginx?
application/vnd.rar rar; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.