What is the MIME type of .xlsx files?
The MIME type (media type) for Microsoft Excel files with the .xlsx extension is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. A ZIP archive of XML; already compressed. Serve with this exact type so browsers keep the .xlsx extension on download.
Content-Type header
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8
Text-based types should include a charset so the browser decodes characters correctly.
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; |
Apache (.htaccess) | AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx |
IIS (web.config) | <mimeMap fileExtension=".xlsx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /> |
| Node.js / Express | res.type('xlsx') or res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8') |
| Amazon S3 | Set Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet on the object (metadata), or pass --content-type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet to aws s3 cp |
Should .xlsx files be compressed?
No. Microsoft Excel files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave application/vnd.openxmlformats-officedocument.spreadsheetml.sheet 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 .xlsx?
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.How do I set the Content-Type for .xlsx in Nginx?
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.