What Is an EXE File? How to Read the Header of a Windows Program Without Starting It
An EXE file is a Windows program in the Portable Executable format, and a reader that opens EXE files can still accept a damaged one. Jump to your question below, or work through it in order.
What Is an EXE File? A Windows program, and the name is only a label
Short answer
An EXE file is a program for Windows. It starts with the letters MZ, and a second header named PE gives the chip, width and kind of window. A double click starts the program, and no viewer shows what it does.
We read 32 EXE files with five readers, and we damaged one EXE file in 31 ways. The readers matched on all 32 good files and split on 12 of the 31 damaged copies. Four readers opened an EXE file that claims 200 sections, and Microsoft says Windows stops at 96.
To check an EXE file without starting it, read the six steps. To see what is inside, read the layout. If an EXE file will not start, begin with the eight causes.
An EXE file is a program for Windows. It starts with the letters MZ, and a second header named PE gives the chip, width and kind of window. The ending is only a label, because a program can have any name.
Picture a file called setup.exe in your Downloads folder. You did not make it, and nothing on the screen says what it does. It is one of the EXE files that Windows reads as programs, and the name is no proof.
Microsoft's list of file name extensions calls the ending an executable program file. FileInfo files EXE files under executable files and names Microsoft as the developer.
The ending causes the first mix up. We copied one EXE file to 10 names, like photo.jpg, notes.txt and report.docx. Four readers still found the same Windows program in all 10 files, so the first bytes decide what the file is.
The format is called Portable Executable, or PE. Wikipedia says Microsoft introduced it with Windows NT 3.1. The same format covers DLL files and other endings. Our MSI file page covers installer files, which are a different format from EXE files.
Who makes EXE files
Compilers and linkers make EXE files. Our 32 EXE files come from 10 public Python packages. They include build tools like CMake and Ninja and tools like uv and ruff. They also include the launchers that pip and setuptools put next to your scripts.
Most are command line tools and launchers. 10 are signed and 22 are not. We started none of them. The tests below also use 31 damaged copies and 10 renamed copies of one EXE file.
EXE file facts at a glance
| Property | Value |
|---|---|
| Meaning | A program file for Windows in the Portable Executable format, called PE for short. |
| Ending | .exe. The same format covers .dll, and Wikipedia lists .sys, .scr, .ocx and other endings too. |
| Made by | Microsoft. Wikipedia says the format came with Windows NT 3.1. |
| First bytes |
4d 5a (MZ) at byte 0, and 50 45 00 00 (PE) at the offset stored at byte 60.
|
| Media type |
application/, per IANA, which lists .exe and .dll.
|
| Opens with | Windows starts it. 7-Zip, pefile, LIEF, file and objdump read the headers. |
| Main risk | IANA says the file contains native code that executes with the rights of the user, with no sandbox. |
| Our tests | 32 EXE files, 31 damaged copies, 10 renamed copies and 5 DLL files, read by five readers on Linux. |
Wrong page? A file that ends in .msi, .dll or .elf is a different format. Compare them by their first bytes.
What Is Inside an EXE File? Two checks, two headers and the sections
An EXE file has a DOS header with MZ at byte 0, an offset at byte 60, a PE header, a section table and the sections. In our 14,336 byte example the PE header starts at byte 256, and the sections start at byte 1,024.
We took the smallest 64 bit EXE file in our set, cli-64.exe from the setuptools package, so every byte can be read. It is 14,336 bytes. The figure shows the blocks from the outside in.
Read the figure from the top. Blocks 1 and 3 are the two checks that make a Windows program. The DOS header starts with MZ, which Wikipedia's page on MZ says are the initials of Mark Zbikowski, an MS-DOS developer. The offset at byte 60 points to the letters PE.
Block 2 is a leftover. Microsoft's PE format page says the default stub prints a message that the program needs Windows when the EXE file is started in MS-DOS. A builder can supply another stub.
The two headers that answer most questions
The file header gives the machine type, number of sections and characteristics. The optional header gives the magic, subsystem and data directories. Despite the name, every EXE file needs it. Microsoft says the magic is 10b for PE32 and 20b for PE32+.
| Field | Where it lives and what it says |
|---|---|
| Machine |
File header. 14c is x86, 8664 is x64 and aa64 is ARM64. It names the chip the program was built for.
|
| Sections | File header. Our files had 5 to 9. Microsoft says the Windows loader limits the count to 96. |
| Characteristics |
File header. The flag 0002 marks an executable image and 2000 marks a DLL.
|
| Magic |
Optional header. 10b is the 32 bit PE32 layout, and 20b is the 64 bit PE32+ layout.
|
| Subsystem |
Optional header. 2 is a windowed program and 3 is a console program.
|
| Data directories | Optional header. 16 slots for imports, resources, certificates and more. 7 of the 16 were in use in cli-64.exe. |
What the sections contain
Sections contain the code and the data. All 32 of our EXE files have .text, .rdata, .data and .reloc. 26 have .pdata and 25 have .rsrc. Builders name sections as they like, so a name is a hint and no promise.
The .rsrc section contains resources. 7-Zip lists the manifest of cli-64.exe as .rsrc/, 381 bytes long. The other five sections of that EXE file are code and data that no viewer can read as text.
What follows the sections
Some EXE files end with extra data. 10 of our 32 end with a certificate table, between 15,664 and 21,072 bytes long. Microsoft says the loader does not map that table into memory, and that it belongs at the end of the file.
A certificate table shows that a signature exists. It does not show that the signature is valid, and we verified none. The other 22 of our EXE files end with their last section.
The headers are small. Our check script reads about 330 bytes to name the machine, width, subsystem and kind of file. It parses no section, so a damaged section or a cut file can pass it, as the damage tests show.
Which Kind of EXE File Do You Have? Three header fields, and a name that misleads
Three header fields sort EXE files. They are the machine type, format width and subsystem. Our 32 EXE files were 22 x64, 6 x86 and 4 ARM64, and 24 console programs and 8 windowed programs. The file name was no guide.
Most questions about an EXE file come down to these fields. Will it start on my PC? Will it open a window? Is it 32 bit or 64 bit? The header answers all three, and no program has to start for you to read them.
Which chip an EXE file needs
Microsoft lists 14c for x86, 8664 for x64 and aa64 for ARM64. Our 32 EXE files had 22 x64, 6 x86 and 4 ARM64. All 6 x86 EXE files use the 32 bit PE32 layout, and all 26 others use PE32+.
Microsoft's page on 32 bit programs says WOW64 starts x86 programs on 64 bit x64 Windows. It also says 64 bit Windows does not support 16 bit programs, and that a launch attempt fails with ERROR_BAD_EXE_FORMAT. We started no EXE file, so these rules come from Microsoft and not from our tests.
Console or windowed
The subsystem is 3 for console programs and 2 for windowed ones. In our set 24 EXE files are console programs and 8 are windowed. Console programs write to a text window, and windowed ones draw their own.
Names mislead here. Four EXE files named gui in the setuptools package have subsystem 3, the console. Three EXE files named w32, w64 and w64-arm in the pip package have subsystem 2. Read the header and ignore the name.
DLL, .NET and signed
Three more checks come from the headers. None of our 32 EXE files has the DLL flag, and none has a .NET header. 10 have a certificate table. Our 5 DLL files all have the DLL flag, and 2 of them have a .NET header.
Not sure the file is a Windows program at all? Check it with our script.
What Did We Find in 32 EXE Files? Five readers agreed, apart from one gap
We read 32 EXE files from 10 public Python packages with five readers. Four of them handled all 32 files. Only objdump missed any, because it did not know the 4 ARM64 files. The headers gave 7 facts, and one is a privacy leak.
We took 32 Windows EXE files from the wheels of 10 public Python packages and recorded the SHA256 hash of every one. The sizes range from 11,776 bytes to 33,879,632 bytes. We started none of them, and we scanned none for malware.
The readers were pefile 2024.8.26, LIEF 1.0.0, file 5.45, objdump from GNU Binutils 2.42 and 7-Zip 25.01, on Python 3.13 and Linux. We compared the machine, width, subsystem, section count and DLL flag. No hash changed after any test.
| Test | Result |
|---|---|
| Machine type | 22 x64, 6 x86 and 4 ARM64. pefile, LIEF and the file command named all 32. objdump named 28 and said "file format not recognized" for the 4 ARM64 files. |
| Format width | 26 PE32+ and 6 PE32. The 6 PE32 files are the 6 x86 files. |
| Subsystem | 24 console and 8 windowed. 4 files named gui have the console subsystem. |
| Certificates | 10 EXE files end with a certificate table. We verified no signature. |
| Checksums | The optional header stores a checksum. 14 files store 0, 17 store the right value and 1 stores a wrong one. |
| Time stamps |
Microsoft says 0 or ffffffff is no meaningful date. None of our 32 files has either value.
|
| Build paths | 14 files name a PDB file in a debug record. In 8 of them the record gives a full folder path on the builder's machine. |
The readers agreed on every field they could read in our EXE files. Header reading is easy. pefile read all 32 EXE files in 0.5 seconds, LIEF in 0.2, file in 0.2 and objdump in 2.7.
The 4 ARM64 files that objdump did not know
Four of our EXE files are ARM64 builds. They are cli-arm64.exe and gui-arm64.exe from setuptools and t64-arm.exe and w64-arm.exe from pip. objdump answered "file format not recognized" for all four. The other four readers named the machine, subsystem and sections.
The gap is a limit of the objdump build we used, which came with Ubuntu. It shows why one reader is a weak test for EXE files. A reader that fails on machine types it does not know says nothing about the EXE file.
What a debug record can reveal
14 of our 32 EXE files contain debug records that name PDB files. In 8 of them the record gives a full folder path on the builder's machine, so programs can reveal user names or build server folders. We print none of those paths.
The record is in the EXE file for the builder's debugger and does nothing when the program starts. If you build programs, check what your debug record says before you share the EXE file.
Read the study with care. It shows what five readers do with 32 EXE files from 10 Python packages. Most are command line tools and launchers, and none is an installer or a driver. A reader that agrees on our EXE files can still fail on yours.
What Do Readers Do With a Damaged EXE File? 31 broken copies, five readers and 12 split decisions
We damaged one 14,336 byte EXE file in 31 ways. All five readers refused 8 copies, all five opened 11 and the readers split on 12. pefile and LIEF opened 23, file 22, objdump 17 and 7-Zip 15. We started no copy, so opened does not mean Windows would start it.
The 31 damaged copies of one EXE file come in six groups. Group A damages the first bytes, B the offset at byte 60 and C the PE signature. Group D cuts the EXE file short, E changes header fields and F adds data or moves the certificate table. Every copy changes one thing.
The 8 copies that every reader refused
Copies A1 to D1 broke one of the two checks. Their damage is zeroed first bytes, MZ changed to ZM or a PE signature of PX or zeros. Others set the offset at byte 60 to 0, past the end or off by 4. The last one cuts the file to 64 bytes. All five readers refused all eight.
The messages differ. pefile said the ZM copy looks like a ZM executable and not a PE file. The file command named 6 of the 8 copies MS-DOS executables and the other 2 data.
The 11 copies that every reader opened
Copies D5, E4, E8 to E15 and F4 passed all five readers. Among them are a checksum of deadbeef, an image size of 0 and a time stamp of ffffffff. Microsoft says that time stamp has no meaning, and no reader said a word.
E12 clears the executable image flag. Microsoft says an EXE file without that flag is a linker error, and all five readers still opened it. The file command also gave wrong labels. It called E4 a Mono or .Net assembly, because we set the magic to 32 bit on a 64 bit file.
The 12 copies that split the readers
Three cut copies, D2 to D4, opened in pefile, LIEF and the file command and failed in 7-Zip. D2 also stopped objdump. The file command printed "6 sections" for the 512 byte copy, because it reads the count from the header and not from the file.
Machine changes E1 to E3 stopped objdump only. E5, with 0 sections, stopped 7-Zip only. E6 claims 200 sections, and objdump refused it while four readers opened it. E7, with an optional header size of 0, stopped objdump and 7-Zip.
Group F shows how a reader's start decides what it sees. 7-Zip refused 1 KB of zeros and 1 MB of random bytes appended to the EXE file. With a ZIP archive appended, the file command and 7-Zip saw a ZIP, and pefile, LIEF and objdump saw the PE header.
Opened is not the same as started
We started no copy. A reader needs the header fields of an EXE file to be readable, and Windows needs them to be right. Four readers opened a copy that claims 200 sections, and Microsoft says the loader stops at 96.
A quiet report from a reader proves the header parses and nothing more. Do not read it as proof that the EXE file starts, or that it is safe.
Read the grid with care. Every copy changes one thing in one 64 bit console EXE file. Damage in the wild changes many things at once. We did not start a copy, so the grid shows how readers answer and says nothing about Windows.
What Does Our Expert Say About EXE Files? A note from Neeraj Singh on checking before you start
Read an EXE file with two tools before you trust one answer. Our five readers agreed on 32 good files and split on 12 of 31 damaged copies. A header check takes seconds, and it never starts the program.
Expert insight
“An EXE file looks like a program, so people judge it by its icon and its name. In our tests four readers opened a copy with 200 sections, and a renamed copy still read as the same program. Read the header, compare two tools and never start a file you cannot place.”
Why a name or a quiet reader proves little
A reader that opens an EXE file shows that the header parses. It does not show that the program is safe or that Windows will start it. In our tests every reader opened the checksum copy and the time stamp copy without a word.
The check has a limit. Two readers that agree can both be wrong, and neither reads the code. The script from the check reads about 330 bytes, so compare its answer with a second reader on any EXE file you rely on.
Copy the EXE file before you touch it. Write down the SHA256 hash of the original and work on a copy. The hash shows which file you received, and it lets you spot a changed download later.
How Do You Open an EXE File? A double click starts it, so look inside another way
Windows starts an EXE file by double click, and that shows nothing about the contents. To look inside, use 7-Zip, pefile in Python or our 46 line script. We read all 32 EXE files with five readers, and none of them starts the program.
A double click starts the program, so it is the wrong way to open an unknown EXE file. The table lists the readers we used. It marks what we tested, because we worked on Linux and started no file.
| Program | What it does |
|---|---|
| Windows | Starts the program by double click. It shows nothing about the contents, and we started no file. |
| 7-Zip | Version 25.01 recognized all 32 EXE files as PE files and listed 5 to 20 sections and resources per file. The FileInfo page also lists WinRAR, which we did not test. |
| pefile | A Python module, version 2024.8.26. It matched all 32 EXE files and opened 23 of 31 damaged copies. |
| LIEF | A Python module, version 1.0.0. It matched all 32 EXE files and opened 23 of 31 damaged copies. |
| file | A command, version 5.45. It matched all 32 EXE files and opened 22 of 31 damaged copies, with one false .Net label. |
| objdump | A GNU Binutils command, version 2.42. It matched 28 EXE files, missed the 4 ARM64 files and opened 17 of 31 damaged copies. |
| Our script | A 46 line Python script that reads about 330 bytes. It refused the same 8 damaged copies as every other reader. |
Open an EXE file with 7-Zip
7-Zip treats an EXE file as an archive of its sections. The command 7zz l cli-64.exe lists the six sections of our example. The manifest appears as .rsrc/, and the sizes match the section sizes in the figure.
7zz l cli-64.exe
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2023-05-20 01:52:36 ..... 6076 6144 .text
2023-05-20 01:52:36 ..... 4908 5120 .rdata
2023-05-20 01:52:36 ..... 512 512 .data
2023-05-20 01:52:36 ..... 492 512 .pdata
..... 381 381 .rsrc/MANIFEST/1
2023-05-20 01:52:36 ..... 48 512 .reloc
------------------- ----- ------------ ------------ ------------------------
2023-05-20 01:52:36 12417 13181 6 files
Add -slt for the technical view of an EXE file. For cmake-gui it printed the CPU, subsystem, linker version, checksum and 16 data directories. 7-Zip refused 16 of our 31 damaged copies, more than any other reader, so a refusal can mean damage or a strict reader.
Open an EXE file with Python
Install the module with pip install pefile. The short script lists the DLLs that an EXE file imports. For pythonservice.exe from pywin32 it printed 12 lines, and two of them, python312.dll and pywintypes312.dll, belong to Python and pywin32.
import sys, pefile
pe = pefile.PE(sys.argv[1])
for entry in pe.DIRECTORY_ENTRY_IMPORT:
print(entry.dll.decode().lower(), len(entry.imports))
advapi32.dll 6
shell32.dll 1
python312.dll 18
pywintypes312.dll 1
kernel32.dll 23
vcruntime140_1.dll 1
vcruntime140.dll 7
api-ms-win-crt-stdio-l1-1-0.dll 5
api-ms-win-crt-heap-l1-1-0.dll 2
api-ms-win-crt-runtime-l1-1-0.dll 23
api-ms-win-crt-math-l1-1-0.dll 1
api-ms-win-crt-locale-l1-1-0.dll 1
LIEF installs as pip install lief. Both modules read the same fields, and the study shows where the other readers differ. Use two readers on any EXE file you rely on.
Open an EXE file on Windows
Windows has no viewer for the contents of an EXE file. It starts the program, and that is the risk. For anything you did not make, copy the EXE file to a reader first, as the check shows, and read the header before any double click.
Do not use a double click to look. A double click starts the program with your rights. To see what an EXE file contains, use one of the readers above. The safety section explains why.
How Do You Check an EXE File? Six steps that never start the program
Check an EXE file in six steps that never start it. Read the first two bytes, the offset at byte 60 and PE signature, then read the headers with our 46 line script. The script names the kind and the machine, and it reads about 330 bytes.
The first four steps need no Python. The xxd command prints bytes, and the file command names the type of an EXE file. For cli-64.exe the three reads below show MZ at byte 0, an offset of 256 at byte 60 and the letters PE at byte 256.
xxd -g 1 -l 2 cli-64.exe
00000000: 4d 5a MZ
xxd -g 1 -s 60 -l 4 cli-64.exe
0000003c: 00 01 00 00 ....
xxd -g 1 -s 256 -l 4 cli-64.exe
00000100: 50 45 00 00 PE..
file -b cli-64.exe
PE32+ executable (console) x86-64, for MS Windows, 6 sections
The offset is stored with the low byte first, so 00 01 00 00 means 256. That is the byte where the PE header of the EXE file starts, and the same number appears in the figure. The file command printed the same kind, machine and section count as the script.
Check EXE files with Python
The script reads the first 64 bytes and then the PE headers. It prints the kind, machine, subsystem, sections, certificate table and .NET header. It never opens a section, and it never starts the EXE file.
#!/usr/bin/env python3
"""pe_peek.py - read the headers of a Windows program file and print what they say. Never starts the file.
Usage: python3 pe_peek.py FILE [FILE ...]
"""
import os, struct, sys
MACHINE = {0x14c: "x86 (32 bit)", 0x8664: "x64 (64 bit)", 0xaa64: "ARM64", 0x1c0: "ARM", 0x1c4: "ARM Thumb-2"}
SUBSYSTEM = {1: "native", 2: "GUI (windowed)", 3: "console", 9: "Windows CE", 10: "EFI application"}
def peek(path):
size = os.path.getsize(path)
name = os.path.basename(path)
with open(path, "rb") as f:
head = f.read(64)
if head[:2] != b"MZ":
return "%s: not a DOS or Windows program (no MZ at byte 0)" % name
lfanew = struct.unpack_from("<I", head, 0x3C)[0]
if lfanew == 0 or lfanew + 24 > size:
return "%s: MZ found, but no PE header (old DOS program, or e_lfanew is wrong)" % name
f.seek(lfanew)
pe = f.read(24 + 240)
if pe[:4] != b"PE\0\0":
return "%s: MZ found, but no PE signature at byte %d (old DOS or 16 bit Windows program, or damaged)" % (name, lfanew)
machine, nsec = struct.unpack_from("<HH", pe, 4)
opt_size, chars = struct.unpack_from("<HH", pe, 20)
magic = struct.unpack_from("<H", pe, 24)[0]
subsystem = struct.unpack_from("<H", pe, 24 + 68)[0] if len(pe) >= 24 + 70 else -1
dd = 24 + (112 if magic == 0x20B else 96)
cert_off, cert_size = struct.unpack_from("<II", pe, dd + 4 * 8) if len(pe) >= dd + 40 else (0, 0)
clr = struct.unpack_from("<I", pe, dd + 14 * 8)[0] if len(pe) >= dd + 120 else 0
kind = "DLL" if chars & 0x2000 else "EXE"
lines = [
"%s: %s, %s" % (name, kind, "PE32+" if magic == 0x20B else "PE32" if magic == 0x10B else "magic %#x" % magic),
" machine %s" % MACHINE.get(machine, hex(machine)),
" subsystem %s" % SUBSYSTEM.get(subsystem, subsystem),
" sections %d" % nsec,
" signature %s" % ("certificate table present (%d bytes), not checked" % cert_size if cert_size else "no certificate table"),
" .NET %s" % ("CLR header present" if clr else "no CLR header"),
]
return "\n".join(lines)
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.exit(__doc__)
for p in sys.argv[1:]:
print(peek(p))
Here is what it printed for six files. They are an x64 console program, an ARM64 program named gui, a signed program, a windowed x86 program, a DLL with the ending .pyd and a .NET DLL.
python3 pe_peek.py cli-64.exe gui-arm64.exe uv.exe w32.exe win32api.pyd ClrLoader.dll
setuptools__setuptools__cli-64.exe: EXE, PE32+
machine x64 (64 bit)
subsystem console
sections 6
signature no certificate table
.NET no CLR header
setuptools__setuptools__gui-arm64.exe: EXE, PE32+
machine ARM64
subsystem console
sections 6
signature no certificate table
.NET no CLR header
uv__uv-0.13.5.data__scripts__uv.exe: EXE, PE32+
machine x64 (64 bit)
subsystem console
sections 8
signature certificate table present (15664 bytes), not checked
.NET no CLR header
pip__pip___vendor__distlib__w32.exe: EXE, PE32
machine x86 (32 bit)
subsystem GUI (windowed)
sections 5
signature no certificate table
.NET no CLR header
pywin32__win32api.pyd: DLL, PE32+
machine x64 (64 bit)
subsystem GUI (windowed)
sections 6
signature no certificate table
.NET no CLR header
clr_loader__ClrLoader.dll: DLL, PE32
machine x86 (32 bit)
subsystem console
sections 4
signature no certificate table
.NET CLR header present
The first line of every answer names the kind. A DLL file prints DLL, and the ending does not matter. Damaged EXE files print a reason instead of a guess, and the next listing shows three of them.
python3 pe_peek.py A2.exe B2.exe C1.exe
A2.exe: not a DOS or Windows program (no MZ at byte 0)
B2.exe: MZ found, but no PE header (old DOS program, or e_lfanew is wrong)
C1.exe: MZ found, but no PE signature at byte 256 (old DOS or 16 bit Windows program, or damaged)
What the script found in our EXE files
| Result | Cases |
|---|---|
| Kind named (37) | The 32 EXE files and the 5 DLL files. The script agreed with pefile on every field, and it named the DLL files as DLL files. |
| Refused (8 of 31) | The 8 damaged copies that broke the MZ check, offset or PE signature. These are the same 8 that all five readers refused. |
| Passed with damage (23 of 31) | Cut copies D2 to D5, a wrong checksum and a cleared executable flag all pass, because the script reads no section. |
| Certificates (10) | The script reports a certificate table in 10 files and says "not checked". |
| Files changed (0) | The SHA256 hash of all 32 EXE files matched the hash we took before the tests. |
The script reads headers and nothing else. It does not parse sections, verify a checksum or a signature, read imports or look at the end of the EXE file. A cut or padded EXE file can pass it, so the damaged copies matter.
Check order for any EXE file
- Copy the EXE file, write its SHA256 hash and work on the copy.
-
Read bytes 0 and 1. They must be
4d 5a, the letters MZ. -
Read the four bytes at byte 60. They give the offset of the PE header, and in cli-64.exe they read
00 01 00 00, which is 256. -
Read the four bytes at that offset. They must be
50 45 00 00, the letters PE and two null bytes. - Read the headers with our script. It names the kind, machine, subsystem, section count, certificate table and .NET header.
- Compare with a second reader, like the file command or 7-Zip. A difference means damage, extra data or a reader limit.
Is an EXE File Safe to Open? Reading is safe, and starting is the risk
Reading an EXE file with a header reader is safe, and starting an unknown EXE file is the risk. IANA says PE files contain native code that executes with the rights of the user and no sandbox. A name proves nothing, because renamed copies still read as programs.
We started none of our 32 EXE files and scanned none for malware. All five readers only read bytes, and the SHA256 hash of every EXE file matched after every test. The files come from public packages of known tools, so their contents are not the worry on this page.
The rename test
We copied one EXE file to 10 names. They were invoice.pdf.exe, photo.jpg, notes.txt, report.docx, archive.zip, data, installer.msi, song.mp3, setup.bin and readme.pdf with a trailing space. Four readers read all 10 as the same x64 console program. They were pefile, LIEF, the file command and 7-Zip.
The ending is a label and the first bytes decide what an EXE file is. If your file manager hides endings, an EXE file named invoice.pdf.exe can look like a PDF. Show full file names in your file manager, and read the header of anything you doubt.
What Windows checks for downloads
Microsoft Defender SmartScreen checks a downloaded EXE file against lists of reported malicious software and well known files. It also checks the reputation and the signature of the program. An EXE file with no reputation brings a warning.
Microsoft says SmartScreen does not protect against malicious files on network shares or internal locations. An EXE file from a share needs your own check.
What a signature shows
A certificate table shows that a signature exists. It says nothing about whether the signature is valid or who made it. 10 of our 32 EXE files have one, and we verified none, so read that number as a count of tables and no more.
Not sure? Do not start it. Check the source, copy the hash and read the header with our script. If the EXE file came in an email you did not expect, delete the message and ask the sender through another route.
Why Will Your EXE File Not Start? Eight causes, and what to do about every one
Most EXE files that will not start fail for one of eight reasons. Read the machine type and the first bytes first, then check the imports. Our five readers refused 8 of 31 damaged copies and opened 11 that Windows can still reject.
We read 32 EXE files and 31 damaged copies with five readers. The readers agreed on every good file and split on 12 damaged copies. The table groups what we saw into eight causes.
The number in brackets matches the cause. Every row says what happens and what to try. The fixes work on a copy, and none starts an unknown EXE file. A reader that says nothing is no sign that the file starts.
| Cause | Result and fix |
|---|---|
| The wrong chip (1) |
An x64 program on an x86 PC, or an ARM64 program on a PC with another chip. Microsoft says 64 bit Windows does not support 16 bit programs and fails the launch with ERROR_BAD_EXE_FORMAT. Fix: Read the machine type with the check script, then get the build for your chip.
|
| A damaged header (2) | All five readers refused 8 of our 31 damaged copies, the ones with a bad MZ, offset or PE signature. Fix: Download the EXE file again and compare the SHA256 hash. We tested no repair. |
| A cut download (3) | Our cut copies D2 to D4 opened in three readers and failed in 7-Zip, and D5 opened in all five. A file cut in half has lost its code. Fix: Download again, then compare the size and the hash with the source. |
| A file that is not a program (4) |
A script, a ZIP or a text file renamed to .exe has no MZ at byte 0. Fix: Read the first two bytes. If they are not 4d 5a, name the actual type with the file command.
|
| A DLL file (5) | A DLL has the same headers with the DLL flag set, and Microsoft says it cannot be started directly. Two of our 5 DLL files end in .pyd. Fix: Read the first line of our script. If it says DLL, find the program that loads it. |
| A missing runtime or DLL (6) |
The import table names the DLLs a program needs. 11 of our 32 EXE files import vcruntime140.dll, and pythonservice imports python312.dll. Fix: List the imports with the Python script and install the runtime the vendor names.
|
| A console window that closes (7) | 24 of our 32 EXE files are console programs. Console programs write to a text window, and it can close the moment the program ends. Fix: Open a terminal first and start the program from there, so the output stays on screen. |
| A SmartScreen warning (8) | SmartScreen warns about a file with no known reputation, as Microsoft explains. Fix: Check the source and the hash. Do not switch the warning off to start a file you cannot place. |
Check an EXE file that will not start, step by step
We tested the reading steps on Python 3.13 and Linux. We did not test them on Windows, and we started no EXE file. The steps keep the original untouched at every point.
- Copy the EXE file, write its SHA256 hash and work on the copy.
- Read the first two bytes and the PE signature with the check steps. If either is missing, the file is not a Windows program.
- Read the machine, width and subsystem with the header script. Compare the machine with your PC.
- If the script says DLL, stop. A DLL file is not started by itself.
- List the imports with the import script and look for runtimes your PC does not have.
- If the file is smaller than the source says, download it again and compare the hash.
- If the program is a console program, start it from a terminal and read its output.
What to send a helper
Short messages get faster answers. Include the details below, and add the output of the script. Its first line names the kind, and the next lines name the machine and the subsystem.
Subject: EXE file will not start
File: name, size in bytes and SHA256 hash
Header: the output of pe_peek.py
System: Windows version, 32 or 64 bit, and the chip
What happens: the exact words of the error or the warning
Source: where the EXE file came from and when it was copied
What no step can fix
Do not try EXE repair sites. A site that offers to fix any program for free can keep the upload, and an EXE file can contain private data. Try the steps above on a copy first.
Can You Convert or Unpack an EXE File? We could list the contents, and we tested no converter
You can list the sections and resources of an EXE file with 7-Zip, which read all 32 of ours. We tested no converter and extracted nothing. A program is built for one chip, so look for the vendor's build in the format you need.
Converting an EXE file means writing its contents in another format. The table lists what we found, and every row names its source. The listing figures come from 7-Zip 25.01 on Linux.
| Type | Finding and source |
|---|---|
| EXE to a list of sections | 7-Zip listed 5 to 20 sections and resources for all 32 EXE files. We extracted none of them. Source: Our tests. |
| EXE to ZIP | We tested no converter. A copy with a ZIP archive appended read as a ZIP in 7-Zip and in the file command, and as a PE file in three other readers. Source: Our tests. |
| EXE to MSI | MSI is a different format. Microsoft's list names it a Microsoft installer file. We tested no converter, so ask the vendor for an MSI. Source: Microsoft. |
| EXE to another chip | Our set has the same launcher as three separate builds for x86, x64 and ARM64. Get the build for your chip. Source: Our tests. |
List the contents of an EXE file
The command 7zz l lists sections and resources. The most entries we saw were 20, for cmake-gui.exe, and the smallest listing had 5. cli-64.exe has 6, as the open section shows. The sizes match the section table.
An EXE file with an archive appended
Our copy F3 is an EXE file, cli-64.exe, with a 608 byte ZIP archive added at the end. The file command named it a ZIP archive with extra data in front, and 7-Zip typed it as ZIP. pefile, LIEF and objdump still read the PE header.
So where a reader starts decides what it sees. If an EXE file answers as a ZIP in one reader and as a program in another, it contains both. We had no self-extracting installer, so we did not test extraction.
Convert an EXE file to MSI
MSI is a different format. Microsoft's extension list names it a Microsoft installer file. We tested no converter. Our MSI page covers the format, and the vendor's own download is the safest source.
Keep the originals. Listing reads the EXE file and never changes it, and our hashes matched. Keep the original and any list side by side. Do not upload an unknown EXE file to an online converter, because the upload shares the file.
How Do EXE Files Differ From DLL, MSI and ELF Files? The first bytes and one flag name the type
An EXE file and a DLL file use the same format, and the DLL flag 2000 in the file header separates them. An MSI file is a different format, and an ELF file starts with 7f 45 4c 46. The first bytes and one flag name the type.
Six types get mixed up, and some share the headers of EXE files. The table lists what separates them. Every row ends with its source.
| Format | What separates it |
|---|---|
| EXE file |
4d 5a at byte 0 and 50 45 00 00 at the offset from byte 60. The DLL flag is clear. All 32 of our files. Source: Our tests.
|
| DLL file |
The same headers with the DLL flag 2000 set. All 5 DLL files in our set had it, and 2 had a .NET header. The endings were .dll and .pyd. Source: Our tests.
|
| Other PE files | Wikipedia lists .sys, .scr, .ocx and other endings for the same format. Source: Wikipedia. |
| MSI file | Microsoft's list names it a Microsoft installer file. It is not a PE file, and our page on MSI installers covers it. Source: Microsoft. |
| ELF file |
Starts with 7f 45 4c 46. It is the program format of Linux, and our ELF page covers it. Source: Our ELF page.
|
| DOS MZ file | The older format that PE extends, per Wikipedia. Microsoft says 64 bit Windows does not support 16 bit programs. Source: Wikipedia and Microsoft. |
Separate them with our script
Our script reads the DLL flag of an EXE file and prints DLL or EXE on the first line. For win32api.pyd it printed DLL, and for ClrLoader.dll it printed DLL with a .NET header. For a file with no MZ it prints a refusal and never guesses.
Why the ending misleads
Two of our 5 DLL files end in .pyd, and they have the same headers as any .dll. Our renamed EXE files ended in .jpg, .txt and .docx and still read as one program. The ending is a label, and the headers say what the file is.
Which one do you have
What Is the EXE File Format Made Of? The facts we could check, and where they came from
EXE files use the Portable Executable format, which Microsoft introduced with Windows NT 3.1 per Wikipedia. The facts below come from Microsoft, Wikipedia, IANA, FileInfo and our checks of 32 EXE files and 31 damaged copies.
| Part | What we could check |
|---|---|
| Maker | Microsoft. Wikipedia says the format came with Windows NT 3.1 and replaced the 16 bit NE format. |
| Name | Portable Executable, or PE. Wikipedia says it extends the DOS MZ format and COFF. |
| First bytes |
4d 5a (MZ) at byte 0, and 50 45 00 00 at the offset stored at byte 60. cli-64.exe has 256 there.
|
| Machine types |
14c for x86, 8664 for x64 and aa64 for ARM64, per Microsoft.
|
| Format width |
10b for PE32 and 20b for PE32+. Microsoft says PE32+ allows a 64 bit address space and an image of up to 2 GB.
|
| Subsystem |
2 for a windowed program and 3 for a console program, per Microsoft. The file command named 9 Windows CE.
|
| Sections | Our files had 5 to 9. Microsoft says the Windows loader limits the count to 96. |
| Certificates | Data directory 4. Microsoft says the table is not loaded into memory and belongs at the end of the file. |
| Endings | .exe. IANA lists .exe and .dll for the media type, and Wikipedia lists .sys, .scr and others. |
| Media type |
application/, registered with IANA on 23 April 2015 with the magic number MZ.
|
| Detection |
4d 5a, then 50 45 00 00. The file command names it "PE32+ executable" or "PE32 executable".
|
| Related formats | DLL files use the same format. MSI is a different one, and ELF is the Linux program format. |
| Our tests | 32 EXE files, 31 damaged copies, 10 renamed copies, 5 DLL files, five readers and a 46 line script on Linux. |
About the values we list
Facts about structure come from Microsoft's PE format page and from our EXE files, and every row names its source. The section limit of 96, the time stamp rule and the checksum rule come from Microsoft and were not tested by starting a file.
Wikipedia gives the MZ initials and the history of EXE files. IANA gives the media type and the security note. We list no price, because no tool on this page is sold.
What we left out
We started no EXE file, and we tested no Windows loader, antivirus program or SmartScreen. We verified no signature. We had no .NET EXE file, no packed program, no self-extracting installer and no 16 bit DOS program, so we tested none of them.
Our 32 EXE files come from 10 public Python packages and are mostly command line tools and launchers. Our damage copies change one thing at a time in one file. A reader that fails on our files can still work on yours.
Sources checked
For the format, see Microsoft's PE format reference, the Wikipedia article on Portable Executable and the Wikipedia article on DOS MZ executables. For the media type, see the IANA registration.
For the ending, see FileInfo on EXE and the Microsoft list of common extensions. For 32 bit programs, see the WOW64 page from Microsoft. For downloads, see the Microsoft Defender SmartScreen overview.
Every count came from the files and scripts in our research folder.
Frequently Asked Questions About EXE Files
What is an EXE file?
An EXE file is a program for Windows in the Portable Executable format. It starts with the letters MZ, and a PE header gives the chip, width and subsystem. A double click starts the program, and no viewer shows what it does.
How do I open an EXE file?
Windows starts it by double click, which shows nothing about the contents. To look inside, use 7-Zip, pefile in Python or our 46 line script. We read all 32 of our EXE files with five readers, and none of them starts the program.
Is an EXE file a virus?
No. An EXE file is a program, and a program can be harmless or harmful. IANA says PE files contain native code that executes with the rights of the user and no sandbox. Check the source and the hash before you start one. We scanned none of our 32 files for malware.
What does EXE stand for?
EXE is short for executable. Microsoft lists the ending as an executable program file, and FileInfo files it under executable files. The letters MZ at the start of an EXE file are a different thing.
What is inside an EXE file?
A DOS header, DOS stub, PE header, section table and sections. The cli-64.exe file from our tests is 14,336 bytes, with the PE header at byte 256 and six sections from byte 1,024. 10 of our 32 EXE files end with a certificate table.
How do I find out if an EXE file is 32 bit or 64 bit?
Read the machine type and the magic. The machine is 14c for x86 and 8664 for x64, and the magic is 10b for 32 bit and 20b for 64 bit. Our script prints both. All 6 x86 EXE files in our set are 32 bit, and the other 26 are 64 bit.
What is the difference between an EXE file and a DLL file?
They use the same format. A DLL file has the DLL flag, 2000, set in the file header, and Microsoft says it cannot be started directly. All 5 DLL files in our set had the flag, and 2 of them had a .NET header.
Why will my EXE file not start?
Eight causes cover most cases. They include the wrong chip, damaged or cut downloads, renamed files, DLL files, missing runtimes and SmartScreen warnings. Read the machine type and the first bytes first.
Can I open an EXE file on a Mac or on Linux?
You can read the header on any system. We read all 32 of our EXE files on Linux with five readers. Starting a Windows program is different, and we tested no compatibility layer on Mac or Linux.
Can I convert an EXE file to MSI or ZIP?
We tested no converter. 7-Zip listed 5 to 20 sections and resources for all 32 of our EXE files, and it read a ZIP archive appended to a copy. MSI is a different format, so ask the vendor for the MSI.
Can a renamed EXE file still be a program?
Yes. We copied one EXE file to 10 names, like photo.jpg and notes.txt, and four readers read all 10 as the same program. The ending is a label, and the first bytes decide what the file is.
What does MZ mean at the start of an EXE file?
MZ are the first two letters of an EXE file, at byte 0, 4d 5a in hex. Wikipedia says they are the initials of Mark Zbikowski, an MS-DOS developer. A PE file also needs the letters PE at the offset stored at byte 60.
Still Stuck With an EXE File? Seven routes out, depending on what went wrong
Read the machine type and the first bytes. The cause table lists what to try in order.
Do not start it. Read the safety section for what to check first.
Is it an installer? The page on MSI files covers Microsoft installer files, which are a different format.
Is it a Linux program? The page on ELF files covers the program format of Linux, with its own damage tests.
Is it a Mac or Debian package? The page on DMG files covers Mac disk images, and the page on DEB files covers Debian packages.
Is it a Java launch file? The page on JNLP files covers files that start Java programs.
Is it a file type you do not know? Browse the file extension resource library, or send it on the submit a file type page.