# .XLSX MIME Type and Content-Type Header

> Modern Excel workbooks — a ZIP archive of XML files.

- MIME type: `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
- Extensions: .xlsx
- Content-Type header: `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
- Compress in transit: no (already compressed)
- File signature: `50 4B 03 04` (the ZIP signature — this format is a ZIP archive inside)

## Good to know

- When generating spreadsheets for download, CSV is simpler — but XLSX preserves types, formatting and multiple sheets.
- Macro-enabled workbooks use `.xlsm` with `application/vnd.ms-excel.sheet.macroEnabled.12`.

## Server configuration

### nginx (inside the types block in mime.types)

```
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
```

### Apache (.htaccess or server config)

```
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx
```

### Express

```
res.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
```

### Python

```
import mimetypes

mimetypes.add_type("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", ".xlsx")
```

### HTML file input

```
<input type="file" accept=".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
```

## FAQ

### What is the MIME type for .xlsx files?

`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`.

### What Content-Type header should a .xlsx file be served with?

`Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`. It's already compressed, so servers shouldn't gzip it.

### How can I tell if a file is really a .xlsx?

Check its bytes rather than the extension: XLSX files start with `50 4B 03 04` (`PK..`) — the ZIP signature — this format is a ZIP archive inside. On the command line, `file --mime-type name.xlsx` does this for you.

## Related types

- [.xls — application/vnd.ms-excel](https://www.devkult.com/mime/xls.md)
- [.csv — text/csv](https://www.devkult.com/mime/csv.md)
- [.docx — application/vnd.openxmlformats-officedocument.wordprocessingml.document](https://www.devkult.com/mime/docx.md)
- [.pptx — application/vnd.openxmlformats-officedocument.presentationml.presentation](https://www.devkult.com/mime/pptx.md)

Open the interactive page: https://www.devkult.com/mime/xlsx