devkult_
tools30converters34
home/mime/.exe

.exe MIME type

Windows executableapps & binaries

application/vnd.microsoft.portable-executable

Windows programs and libraries in Portable Executable format.

MIME typeapplication/vnd.microsoft.portable-executable
Extensions.exe, .dll
Also seen asapplication/x-msdownload, application/x-dosexec
Content-Typeapplication/vnd.microsoft.portable-executable
Compress in transit?No — already compressed
File signature4D 5A (MZ)
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.

Serve .exe files with the right type

The response header to send:

Content-Type: application/vnd.microsoft.portable-executable

Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:

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">

Check it

See what a server sends for a file, and what type a local file really is by its contents:

curl -sI https://example.com/file.exe | grep -i '^content-type:'
file --mime-type file.exe

Frequently asked questions

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

Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options