# .EXE MIME Type and Content-Type Header

> Windows programs and libraries in Portable Executable format.

- MIME type: `application/vnd.microsoft.portable-executable`
- Extensions: .exe, .dll
- Also seen as: `application/x-msdownload`, `application/x-dosexec`
- Content-Type header: `application/vnd.microsoft.portable-executable`
- Compress in transit: no (already compressed)
- File signature: `4D 5A` (the DOS header, which points to a PE header that says whether the file is an .exe or a .dll)

## Good to know

- Apache's stock config sends `.exe`, `.dll` and `.msi` as `application/x-msdownload`, and `file --mime-type` reports `application/x-dosexec`. Browsers download them all the same way.
- Downloads get the Mark of the Web, so SmartScreen warns about unsigned or rarely downloaded programs. Code signing reduces the warnings; the Content-Type doesn't.
- On upload forms, check for the `MZ` signature — renaming `setup.exe` to `photo.jpg` doesn't change its bytes.

## Server configuration

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

```
application/vnd.microsoft.portable-executable exe dll;
```

### Apache (.htaccess or server config)

```
AddType application/vnd.microsoft.portable-executable .exe .dll
```

### Express

```
res.set("Content-Type", "application/vnd.microsoft.portable-executable");
```

### Python

```
import mimetypes

mimetypes.add_type("application/vnd.microsoft.portable-executable", ".exe")
mimetypes.add_type("application/vnd.microsoft.portable-executable", ".dll")
```

### HTML file input

```
<input type="file" accept=".exe,.dll,application/vnd.microsoft.portable-executable">
```

## FAQ

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

`application/vnd.microsoft.portable-executable`. You may also see `application/x-msdownload`, `application/x-dosexec`, but `application/vnd.microsoft.portable-executable` is the one to send. The same type covers .dll.

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

`Content-Type: application/vnd.microsoft.portable-executable`. It's already compressed, so servers shouldn't gzip it.

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

Check its bytes rather than the extension: EXE files start with `4D 5A` (`MZ`) — the DOS header, which points to a PE header that says whether the file is an .exe or a .dll. On the command line, `file --mime-type name.exe` does this for you.

## Related types

- [.msi — application/x-msi](https://www.devkult.com/mime/msi.md)
- [.bin — application/octet-stream](https://www.devkult.com/mime/bin.md)
- [.zip — application/zip](https://www.devkult.com/mime/zip.md)

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