SUBMIT A FILE TYPE CONTACT US SUPPORT ABOUT US

What Is an MSI File? The Windows Installer Package, and How to Open, Install and Check One

An MSI file is a Windows Installer package that stores the files, settings and steps for one program. Three readers gave one answer on 6 of the 21 damaged copies we made of one. Jump to your question below, or work through it in order.

31 min read Updated November 2026 Checked against sources and tests

What Is an MSI File? The Windows Installer package that stores files, settings and steps

Short answer

An MSI file is a Windows Installer package. It stores the files, settings and steps that Windows needs to install one program. The msiexec tool reads it, and the file starts with the bytes D0 CF 11 E0 A1 B1 1A E1.

We tested 89 public MSI, MSP, MST and MSM files with three readers, msiinfo, 7-Zip and olefile. 87 opened in all three. We then damaged one package in 21 ways, and the three readers gave one answer on 6 copies.

To look inside one, see the open steps. To install one, see the install steps. If your MSI file will not install, begin with the causes.

An MSI file is a Windows Installer package. It stores the files, settings and steps that Windows needs to install one program, and the msiexec tool reads it. Windows Installer comes with Windows 2000 and later.

Picture a download folder with an MSI file named setup.msi. You double-click it and a wizard opens. Picture a second MSI file that your IT team sends to 400 laptops with no wizard at all. Both files are the same kind, and the same service reads both.

Wikipedia says the service was once named Microsoft Installer, and its codename was Darwin. The first release came on 31 August 1999. The last release, version 5.0, came on 22 July 2009. The program that reads a package is msiexec.exe.

A package is a small database. Wikipedia calls it a loosely relational database built as a COM structured storage. Microsoft's overview says the service installs, maintains and removes applications, updates and services.

The design brings two gains. Wikipedia says the uninstall steps are built for you. Wikipedia also says the service checks one marked file or entry for every component when a program starts. If that item is missing, it reinstalls the feature.

It also has limits. Wikipedia says Windows Installer does not handle dependencies between products. A step outside the standard set needs a custom action, and Wikipedia says a custom action is normally a DLL. So an MSI file is a database that can start code.

Where our MSI files come from

We read 89 public files. 68 came from the test folders of the WiX 3 project, 18 from the WiX project, 2 from winget and 1 from remoteinstall. There are 77 .msi files, 8 .msp files, 1 .mst file and 3 .msm files.

They are test files and not installers from software vendors. They are 3,584 to 290,816 bytes long, the median is 15,872 bytes and the total is 3,682,087 bytes. 72 of the 76 packages that msiinfo opened name a WiX version in their summary.

So this page studies how readers treat the layout, and not a sample of programs from the web. We installed none of them, because Windows Installer needs Windows and our lab uses Linux. We make no claim about what Windows shows when it opens one.

MSI file facts at a glance

Quick facts about MSI files
Property Value
Meaning Microsoft Installer at first, now Windows Installer, per Wikipedia.
Ending .msi for a package. A patch is .msp, a transform is .mst and a merge module is .msm, per Wikipedia.
Maker Microsoft, per Wikipedia.
Reader msiexec.exe, and the Windows Installer service behind it.
Layout An OLE compound file with streams. Most streams are tables, per our tests and Wikipedia.
First bytes d0 cf 11 e0 a1 b1 1a e1. Our example then reads 62 and 3 as the version.
Kinds Named by the root CLSID: 000C1084 for a package, 000C1086 for a patch and 000C1082 for a transform. 76, 8 and 1 of our files.
Status The last release is version 5.0 from 2009, and it comes with Windows 7 and later, per Wikipedia.
Our tests 89 files, 21 damaged copies, 3 readers, a check script of 22 lines and a repair script of 10 lines.

Wrong page? An EXE file is a program that starts itself. See how MSI files differ from EXE files.

Which Kind of MSI File Do You Have? Four kinds, and the root CLSID names the kind

Four file endings belong to Windows Installer: .msi for a package, .msp for a patch, .mst for a transform and .msm for a merge module. The root CLSID names the kind. It starts 000C1084 for 76 of our packages, 000C1086 for 8 patches and 000C1082 for 1 transform.

The ending of an MSI file is a label that anyone can change. The first 8 bytes read the same in all four kinds. The CLSID is a number stored in the first directory entry, and it differs by kind. Follow the figure.

Decision chart with three kinds of Windows Installer file named by the root CLSID, an install package with 76 of our 89 test files, a patch with 8 and a transform with 1, with the number of files that msiinfo, 7-Zip and olefile opened, and a warning that two files fail in all three readers.
Figure 1. Three kinds of Windows Installer file, named by the root CLSID in our 89 test files.

The kinds in detail

Four kinds of Windows Installer files and how three readers handled them
Kind Files and results
MSI, an install package 77 files. 76 have the CLSID 000C1084, and all three readers opened those 76. The 77th starts with the OLE bytes and then contains XML text, so all three refused it.
MSP, a patch 8 files. All have the CLSID 000C1086, and all three readers opened all 8. The Template field lists the product codes the patch can update, per the Template property.
MST, a transform 1 file. It has the CLSID 000C1082, and all three readers opened it. Its Template field reads Intel;1033.
MSM, a merge module 3 files. Two opened in all three readers. The third has 15 CRLF pairs inside it, and all three readers failed on it.

Read the summary stream

Every file has a stream named SummaryInformation. Microsoft lists its properties, and four of them describe the package. We read them with msiinfo on the 76 packages it opened.

Summary values in 76 install packages
Property What we measured
Page Count The minimum Windows Installer version, per the Page Count property. 58 packages say 200, 8 say 300 and 10 say 500.
Word Count A set of flags, per the Word Count property. 54 say 0, 20 say 2 for a compressed source and 2 say 10 for a compressed source with no elevation needed.
Security The values 0, 2 and 4, per the Security property. 73 packages say 2, read-only recommended. 3 say 1, a value that page does not list.
Template A platform and a language, per Microsoft. 73 say Intel and 3 say x64.
CLSID first The root CLSID names the kind. The ending of an MSI file can be changed by anyone.
Version second Page Count 500 means Windows Installer 5.0, per Microsoft. 10 of our packages say 500.
The ending last The ending is a label. One .msi file in our set is a text file with the OLE bytes in front.
Patches are locked All 9 patches and transforms say Security 4, which Microsoft recommends for them.

Not sure your file is an MSI file at all? Check it with our script.

What Is Inside an MSI File? A header, a FAT, a directory and 24 streams

An MSI file is an OLE compound file with a header, a FAT, a directory and streams. Our example is 18,432 bytes long and has 24 streams: 22 for tables and strings, one summary and one cabinet. The header takes the first 512 bytes.

We looked inside one MSI file because its layout explains every result later on this page. Our hello_world.msi comes from the WiX 3 test folder. It installs one file, Readme.txt, and its start shows the header.

The start of one MSI file
xxd -l 48 hello_world.msi
00000000: d0cf 11e0 a1b1 1ae1 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 3e00 0300 feff 0900  ........>.......
00000020: 0600 0000 0000 0000 0000 0000 0100 0000  ................
file -b hello_world.msi | cut -d, -f1-5
Composite Document File V2 Document, Little Endian, Os: Windows, Version 6.1, MSI Installer

The first 8 bytes are the OLE magic. Bytes 24 to 27 read 3e 00 03 00, the version 62 and 3. Bytes 28 and 29 read fe ff, the byte order. Bytes 30 and 31 read 09 00, so a sector is 512 bytes. A mini sector is 64 bytes.

Diagram of one MSI file of 18,432 bytes in six parts: the header of 512 bytes, the FAT sector, the directory, the mini stream, the table streams and the cabinet stream, with three rules about the header, the sector size and the body.
Figure 2. One MSI file from our tests, hello_world.msi. The parts are not drawn to scale.

The parts, one by one

The file has 35 sectors after the header. The FAT takes one sector and lists which sector follows which. The directory takes seven sectors and has 28 slots, and 25 are in use. The first is Root Entry, and the other 24 are streams.

Streams under 4,096 bytes live in a mini stream that Root Entry points to, and it is 5,824 bytes long. 23 of our 24 streams are that small. Only the string data, at 6,845 bytes, lies in ordinary sectors. The cabinet stream is 292 bytes long.

What every part stores

Parts of MSI files and what we saw
Part What it stores
Magic D0 CF 11 E0 A1 B1 1A E1. Copy A1 changes the first byte, and all three readers refused it. Our repair script restores it.
Version and sector size Version 62 and 3 with 512 byte sectors in 68 files, and version 62 and 4 with 4,096 byte sectors in 20. Copy A4 sets a sector of 1,024 bytes, and msiinfo and 7-Zip refused it.
FAT One sector here. Copy C2 marks the directory sector as free, and msiinfo and 7-Zip refused it. Copy C8 zeroes the FAT, and the same two refused it.
Directory The names, sizes and start sectors of all streams. The Root Entry CLSID names the kind. Copy C7 zeroes the sector, and the same two readers refused it.
Table streams 22 streams in our example. Their names start with the character U+4840 and pack every letter into a short code, so we used a small decoder to read them.
Cabinet stream A Microsoft cabinet that stores the program files. 14 of our 76 packages have one inside, and 7 name one outside the file. 7-Zip lists Readme.txt inside ours, size 292.
Summary stream The title, the template, the version and the flags. Copy C6 flips one byte in it, and msiinfo and olefile saw the change while 7-Zip did not.

What the Microsoft pages say about one table

The _Validation table lists every column and the values it allows. The validation table page says the table is used for validation and is not shipped with the database. All 76 packages that msiinfo opened contain it.

So the page and our files disagree, and our files come from build tools and test folders. Our example has 20 tables by the msiinfo count, and the largest package has 89. The median across the 76 packages is 17.

The map is small. Our script checks the magic, the header fields, the FAT, the directory name, the kind and a few markers. It does not read the tables, so it cannot judge them. Copies C3 to C6 show the limit, because the script printed OK for all four and a reader saw a change.

What Did We Find in 89 Test MSI Files? Three readers, and 87 files opened in all of them

We tested 89 public MSI files with three readers. 87 opened in all three, 2 opened in none and no file split the readers. On undamaged files the file decided the result, and not the reader.

We counted a file as opened when a reader read it without an error. msiinfo listed the tables. 7-Zip named the type Compound. olefile read every stream. We used msiinfo 0.103 from msitools, 7-Zip 23.01 and olefile 0.47 on Linux.

Bar chart of 89 public test Windows Installer files by size, from 3,584 bytes to 290,816, next to the number of files that three readers opened, a grid of results by kind of file, and four measured facts.
Figure 3. 89 files, three readers and four measured facts.
89 public test files
87 opened in all three readers
0 opened in only some readers
2 opened in none

What the numbers show

Findings from 89 test files
Finding What we measured
Packages are easy 76 of the 77 .msi files opened in all three readers. All 8 patches and the 1 transform did too.
Two files fail for a clear reason One .msi file is XML text with the OLE bytes written over its start. One .msm file contains 15 CRLF pairs. All three readers refused both.
A text mode copy can be undone We removed the 15 CR bytes from the .msm file. It went from 14,351 to 14,336 bytes, and all three readers opened it.
Nearly all sizes fit a sector 86 of 89 files are an exact multiple of 512 bytes. 68 files use 512 byte sectors and 20 use 4,096 byte sectors.
Cabinets live inside or outside 14 of the 76 packages store a cabinet in the file and 7 name one outside it. We cover what that means for extraction below.
Three files contain a signature stream 3 packages contain a DigitalSignature stream and a certificate stream. We did not check any signature.

What this study cannot show you

These are test files from build tools and test folders. They are not installers from software vendors, and many are made to test one table or one bug. A refusal on the 2 broken files is the right answer.

We installed no file with Windows Installer. Opening a file in a reader means the container is well formed. It does not mean Windows would install the program.

What Happens When an MSI File Is Damaged? 21 broken copies, and the three readers agreed on 6

We damaged one MSI file in 21 ways. The three readers gave one answer on 6 copies and split on 15. Our script flagged or warned on 15 copies, and 3 of those 15 read as the original in all three readers.

Our base file is hello_world.msi, 18,432 bytes. We changed one thing at a time and saved 21 copies. Same means a reader gave the answer it gave on the original. Refused means it stopped with an error. Differs means it opened the copy and answered another way.

Grid of 21 damaged copies of one MSI file against msiinfo, 7-Zip, olefile, our check script and a repair script. The three readers gave one answer on 6 copies, our script flagged or warned on 15, and the repair script restored 4 copies.
Figure 4. 21 damaged copies, three readers, our script and a repair script.

The three readers check different things. msiinfo reads the tables, the summary and the cabinet. 7-Zip lists names and sizes. olefile reads the bytes of every stream. So a flipped byte can change two answers and leave the third alone.

What the grid shows

Results for 21 damaged copies of one MSI file
Group of copies What happened
A wrong magic Copy A1 changes the first byte. All three readers refused it. The repair script restores it, and all three readers then gave the original answer.
A wrong version or sector size Copy A2 sets the minor version to 0 and A9 fills six reserved bytes. All three read both as the original. Copy A4 sets a sector of 1,024 bytes, and msiinfo and 7-Zip refused it.
A wrong byte order Copy A3 swaps the byte order marker. msiinfo and olefile read it as the original, and 7-Zip refused it.
A wrong FAT or directory Copies A6, A7, C2, C7 and C8 break the FAT or the directory. msiinfo and 7-Zip refused all five, and olefile gave another answer on four.
A short or long file Copy B1 removes the last 512 bytes, and only 7-Zip read it as the original. B2 cuts the file in half, and msiinfo and 7-Zip refused it. B3 adds 512 zero bytes, and all three read it as the original.
A text mode transfer Copy B4 changes every LF into CRLF. msiinfo and 7-Zip refused it, and olefile gave another answer.
A flipped byte in a stream Copies C3 to C6 flip one byte in the strings, the cabinet, the validation table and the summary. 7-Zip read all four as the original, because every name and size stayed the same. olefile saw all four.

The pattern is clear. When the container breaks, msiinfo and 7-Zip stop. When one byte inside a stream changes, 7-Zip stays silent, and the other two split. msiinfo saw C3, C4 and C6 but not C5, which is the validation table.

Our script and the repair script

Our check script flagged or warned on 15 copies. 3 of them, A2, A8 and C1, read as the original in all three readers. The script printed OK for 6 copies. For B3 and A9 that was right. For C3 to C6, a reader saw a change. See the script.

The repair script rewrites the header fields. It made 7 copies match the original byte for byte, A1 to A5, A8 and A9. For A1, A3, A4 and A5 that fixed a refusal or a split. It left the other 13 copies as they were.

The script cannot restore a cut file, a broken FAT, a changed stream or a text mode copy. We did not test a repaired file in Windows Installer.

Why a text mode copy is special

Copy B4 changes LF into CRLF, and a text mode transfer does the same. Our base file has 21 LF bytes and no CRLF pairs, so the change is reversible there. A blind CR removal is not safe in general.

17 of the 89 files contain a CRLF pair by chance. A tool that removes every CR from those 17 would damage them. Our .msm test file is the other case: it has 15 pairs and 15 LF bytes, and removing the CR bytes made all three readers open it.

What Does Our Expert Say About MSI Files? A note from Neeraj Singh on comparing readers

We asked our expert what the grid means for someone who has an MSI file and has to decide if it is damaged. He read the 21 copies and the three reader columns.

Neeraj Singh

Expert insight

Never judge an MSI file with one tool. In our tests one flipped byte in the string data changed what two readers returned, while 7-Zip listed the same names and sizes and our own header check printed OK. Open the file with a second tool before you decide it is sound.

Neeraj Singh Manager, Tech Support & Operations 19+ years fixing Windows and system errors

That advice fits the grid. msiinfo and 7-Zip gave the same answer on 15 of the 21 copies. msiinfo and olefile agreed on 10, and 7-Zip and olefile on 7. A second tool that reads the stream bytes is the cheapest test.

How Do You Open an MSI File? Look inside and pull the files out, without installing

To look inside an MSI file without installing it, use msiinfo and msiextract on Linux, 7-Zip or the Python library olefile. All three readers opened 87 of our 89 files. msiextract wrote program files from the 14 packages that store a cabinet inside.

An install is not the only way to read a package. The file is a container, and a reader can list its tables and pull out its files. Microsoft lists /a as an administrative install, so Windows has a built-in route too. We could not test it.

Your options

msiinfo Tested Part of msitools. It lists tables and streams, prints the summary and exports a table as text. It opened 87 of our 89 files.
msiextract Tested Part of msitools. It writes the program files to a folder with their install paths. It wrote files from 14 packages and from none of the other 62.
7-Zip Tested Opens the file as a Compound archive and lists the streams. It opened 87 of 89. On our example it wrote Readme.txt, 292 bytes, without the folders.
olefile Tested A Python library for OLE files. It opened 87 of 89 and reads the bytes of every stream.
msiexec /a Not tested An administrative install, per Microsoft. It needs Windows, and our lab uses Linux.
Orca Not tested A table editor from the Windows SDK. We did not use it.

Read an MSI file without installing it

Start with the summary and the table list. Neither one changes the file. The summary shows who made the package, and the table list shows how large it is. Our example has 20 tables, and the first 8 are below.

The summary and the first tables of one MSI file
msiinfo suminfo hello_world.msi
Title: Installation Database
Subject: HelloWorld_Readme
Author: My Company
Keywords: Installer
Comments: This Installer database contains the logic and data required to install HelloWorld_Readme.
Template: Intel;1033
Revision number (UUID): {FBD9C730-4484-4B19-81C5-ABFA0381F617}
Created: Fri Jan  8 04:21:26 2010
Last saved: Fri Jan  8 04:21:26 2010
msiinfo tables hello_world.msi | head -8
_SummaryInformation
_ForceCodepage
_Validation
AdminExecuteSequence
AdminUISequence
AdvtExecuteSequence
Component
Directory

Export a table to read its rows. The File table lists every file in the package with its size. Our example has one row, Readme.txt, at 292 bytes.

The File table of one MSI file
msiinfo export hello_world.msi File
File	Component_	FileName	FileSize	Version	Language	Attributes	Sequence
s72	s72	l255	i4	S72	S20	I2	i4
File	File
Readme.txt	Readme.txt	Readme.txt	292			512	1

Pull the files out of an MSI file

The Media table says where the files are. A cabinet name that starts with a number sign, like #HelloWorld_Readme.cab, means the cabinet is a stream inside the file. A name without the sign means the cabinet is a separate file.

The Media table of one MSI file
msiinfo export hello_world.msi Media
DiskId	LastSequence	DiskPrompt	Cabinet	VolumeLabel	Source
i2	i4	L64	S255	S32	S72
Media	DiskId
1	1		#HelloWorld_Readme.cab		

In our 76 packages, 14 name a cabinet inside, 7 name one outside, 51 name none and 4 have no Media rows. msiextract wrote files from all 14 with a cabinet inside.

Extract the files of one MSI file
msiextract -C out hello_world.msi
Program Files/HelloWorld_Readme/Readme.txt
find out -type f
out/Program Files/HelloWorld_Readme/Readme.txt

For the 7 packages with an outside cabinet, msiextract wrote no files and exited with code 1. Its error names the cabinet HelloWorldNonAdmin_Readme_External.cab and says there is no such file. It looks in the folder of the MSI file, so put the .cab file beside it.

We had no cabinet for those 7 files, so we did not test that fix. msiextract also exited with code 1 on 10 other packages and wrote no files from them. Its first message is a missing Directory id in 9 of them and a missing table in 1.

Read first Use suminfo and tables before you install anything.
Check the Media table A number sign means the cabinet is inside. No sign means a file beside the MSI.
Use two readers msiinfo, 7-Zip and olefile checked different things on our 21 damaged copies. See the study.
Know the limit Extracted files are not an install. Windows Installer also writes settings and shortcuts.

Is the file a ZIP archive? The ZIP file page covers ZIP files.

How Do You Install an MSI File? Double-click it, or use msiexec with the options

To install an MSI file, double-click it, or use msiexec /i with the path. Add /passive for a progress bar, /qn for no window and /l*v for a log. We installed no file, because msiexec needs Windows and our lab uses Linux.

Everything in this section comes from the msiexec page at Microsoft. We did not test the commands. We list them so you can read a package first, as shown in the steps to read a package, and then install it.

  1. Copy the MSI file to a local folder and keep the original.
  2. Read the summary with msiinfo, as shown above. Check the maker and the product name.
  3. Double-click the file for the wizard, or open a Command Prompt for msiexec.
  4. Type msiexec.exe /i "C:\example.msi" and press Enter.
  5. Add /L*V "C:\package.log" when you want a log. The log is the first place to look if the install fails.
  6. Restart when the installer asks. A restart is not a failure, and Microsoft counts code 3010 as success.

The msiexec options

Common msiexec options, per Microsoft
Option What it does
/i A normal install.
/x Uninstalls a package.
/a An administrative install.
/p Installs a patch. For a silent patch, Microsoft adds REINSTALLMODE="ecmus" REINSTALL="ALL".
/f with letters Repairs an installed package. /fa forces all files to be reinstalled.
/quiet No user interaction.
/passive Shows only a progress bar.
/qn and /qb No window, and a basic window.
/norestart Stops a restart after the install.
/forcerestart Restarts the device after the install.
/L*V and a path Writes a log of everything, with verbose output.

Commands from the Microsoft page

msiexec examples from Microsoft
msiexec.exe /i "C:\example.msi"
msiexec.exe /i "C:\example.msi" /qn
msiexec.exe /i "C:\example.msi" /norestart
msiexec.exe /i "C:\example.msi" /L*V "C:\package.log"
msiexec.exe /p "C:\MyPatch.msp"
msiexec.exe /fa {AAD3D77A-7476-469F-ADF4-04424124E91D}

The last line repairs an installed product by its product code. Our example package lists its code in the Property table, and msiinfo export hello_world.msi Property prints it.

Two of our 76 packages set the Word Count flag 10. The Word Count page says bit 8 marks a package that needs no elevated privileges, and bit 2 marks a compressed source. A package with that flag says it needs no elevated privileges.

What we did not test. We used no Windows machine. We did not start msiexec, install any package, open Orca or check any signature. Treat the commands as Microsoft's, and not as our results.

Does the install end with a number? Read the error codes for 1603, 1618, 1619 and 1620.

How Do You Check an MSI File? Six steps and a script of 22 lines

Check an MSI file in six steps. Copy it, read the first bytes, read the version and the sector size, read the root CLSID, list the tables and use a second reader. Our script of 22 lines does steps two to four.

  1. Copy the file and work on the copy. Keep the original.
  2. Read the first bytes with xxd -l 48 file.msi. The first eight bytes must read d0 cf 11 e0 a1 b1 1a e1.
  3. Read bytes 24 to 27. 3e 00 03 00 means 512 byte sectors, and 3e 00 04 00 means 4,096 byte sectors. We saw both.
  4. Read the root CLSID. 000C1084 is a package, 000C1086 is a patch and 000C1082 is a transform.
  5. List the tables with msiinfo tables file.msi. A package opens with at least 11 tables in our set.
  6. Use a second reader like 7-Zip or olefile. The three readers gave one answer on only 6 of 21 damaged copies.

The check script

The script reads one file at a time. It prints OK when the header, the FAT and the directory agree. It prints WARN for a small oddity and FLAG when something is wrong. It uses only the Python standard library.

msi_peek.py, 22 lines
import struct, sys
d = open(sys.argv[1], 'rb').read()
M = bytes.fromhex('d0cf11e0a1b11ae1'); w = []
KIND = {'84': 'install package (.msi)', '86': 'patch (.msp)', '82': 'transform (.mst)'}
if d[:8] != M: print('FLAG magic bytes are not D0CF11E0A1B11AE1'); sys.exit()
mi, ma, bo, ss, ms = struct.unpack('<HHHHH', d[24:34]); sz = 1 << ss if ss < 16 else 0
nf, ds, _, cut, mf = struct.unpack('<IIIII', d[44:64]); f0 = struct.unpack('<I', d[76:80])[0]
if bo != 0xFFFE or (ma, ss) not in ((3, 9), (4, 12)) or ms != 6 or mi != 62: w.append('FLAG header fields are not a valid v3 or v4 file')
elif nf < 1 or (f0 + 2) * sz > len(d) or (ds + 2) * sz > len(d): w.append('FLAG FAT or directory sector is past the end')
else:
    e = d[(ds + 1) * sz:(ds + 2) * sz][:128]; root = e[:20].decode('utf-16le', 'replace').rstrip('\0')
    kind = KIND.get(e[80:81].hex()) if e[81:84] == b'\x10\x0c\x00' else None
    fat = struct.unpack('<%dI' % (sz // 4), d[(f0 + 1) * sz:(f0 + 2) * sz]); hi = max([i for i, v in enumerate(fat) if v != 0xFFFFFFFF] or [0])
    if fat[f0] != 0xFFFFFFFD or fat[ds] == 0xFFFFFFFF: w.append('FLAG the FAT does not list itself or the directory')
    elif (hi + 2) * sz > len(d): w.append('FLAG the FAT lists sector %d but the file ends sooner' % hi)
    if root != 'Root Entry': w.append('FLAG first directory entry is %r' % root)
    if kind is None: w.append('WARN root CLSID is not a Windows Installer one')
    if len(d) % sz: w.append('WARN size %d is not a multiple of the %d byte sector' % (len(d), sz))
    if cut != 4096: w.append('WARN mini stream cutoff is %d, not 4096' % cut)
    if 'SummaryInformation'.encode('utf-16le') not in d: w.append('WARN no SummaryInformation stream name')
    if b'\x40\x48' not in d: w.append('WARN no table stream names (U+4840)')
print('\n'.join(w) or 'OK ' + kind + ', header, sizes and names agree')
What the script prints
python3 msi_peek.py hello_world.msi
OK install package (.msi), header, sizes and names agree
python3 msi_peek.py A1.msi
FLAG magic bytes are not D0CF11E0A1B11AE1
python3 msi_peek.py C3.msi
OK install package (.msi), header, sizes and names agree

On our 89 files it printed OK for 86 and FLAG for 3. Two of the 3 are the broken files that all three readers refused. The third is a 33,045 byte file with a short last sector, and all three readers opened it.

So a FLAG is a reason to look, and not a verdict. On the 21 damaged copies it printed FLAG for 14, WARN for 1 and OK for 6. The damage grid shows why C3 to C6 got an OK while a reader saw a change.

The repair script

The repair script rewrites the fields of the header. It writes the magic, the byte order, the minor version 62, the mini sector shift 6, six zero reserved bytes and the mini stream cutoff 4096. It takes the sector size from the major version, then pads the file to a sector.

msi_fix.py, 10 lines
import struct, sys
d = bytearray(open(sys.argv[1], 'rb').read())
if len(d) < 512: sys.exit('too short')
d[0:8] = bytes.fromhex('d0cf11e0a1b11ae1'); d[28:30] = b'\xfe\xff'
d[24:26] = struct.pack('<H', 62); d[32:34] = struct.pack('<H', 6); d[34:40] = bytes(6)
d[30:32] = struct.pack('<H', 12 if struct.unpack('<H', d[26:28])[0] == 4 else 9)
d[56:60] = struct.pack('<I', 4096)
sz = 1 << struct.unpack('<H', d[30:32])[0]
d += bytes(-len(d) % sz)
open(sys.argv[2], 'wb').write(d)

It changes the header only, so damage past the first 512 bytes stays. Work on a copy and keep the original. We checked the result with three readers on Linux and not with Windows Installer.

Is an MSI File Safe to Open? Looking is safe, and installing needs care

Reading the bytes of an MSI file starts nothing. Installing it is the risk, because a package can start code with a custom action. Install an MSI file only from a source you trust, and work on a copy when you only want to look.

Wikipedia notes that Windows Installer handles non-standard operations with custom actions. It adds that custom actions are normally developed in DLLs. Code is the reason to take care.

Our lab only read files. We used msiinfo, 7-Zip and olefile on 89 files and installed none. We scanned no file for malware, so we make no claim about the files in our set or about yours.

A package can start code 15 of our 76 packages contain a CustomAction table. An install can start what that table names, per Wikipedia.
Reading is safe msiinfo, 7-Zip and olefile read bytes and tables. They install nothing, and we used all three on 89 files.
A signature stream is only a stream 3 of our 76 packages contain a DigitalSignature stream. We verified no signature, so we make no claim about them.
The ending is a label One of our .msi files is an XML text file with the OLE bytes written over its start. Read the first bytes before you trust the ending.
Work on a copy Keep the original unchanged. Our scripts write a new file and leave the source alone.
Know where the file came from Our 89 files are test files from build tools and test folders. They say nothing about an installer you downloaded.

A file named .msi that does not start with d0 cf 11 e0 a1 b1 1a e1 is not an MSI file. Our check steps show the first look. For a program file, read the EXE file page.

Is the file a Linux package? The DEB file page covers the Debian package format.

Why Will Your MSI File Not Install? Eight causes, and what to do about every one

Eight causes stop an MSI file from installing, and the file is the cause in only some of them. Windows Installer reports a number. Errors 1619 and 1620 mean the package could not be opened, and the other numbers point to the system, the cabinet or the install.

Work down the list in order. The first two come from Microsoft's error list. Causes three to six come from our 21 damaged copies and 76 packages, so every fix names a copy or a count. Causes seven and eight come from Microsoft and need Windows.

1. Error 1619, the package could not be opened Microsoft says the file could be missing or inaccessible. Check the path and the name, and copy the file to a local folder.
2. Error 1620, the package is not valid Microsoft says the file could be something other than a Windows Installer package. Read the first eight bytes. In our tests a wrong magic, a cut file and a text mode copy were refused by msiinfo.
3. The cabinet is missing 7 of our 76 packages name a cabinet outside the file, and msiextract exited with code 1 on all 7. Put the .cab file in the same folder. We had no cabinet, so we did not test that fix.
4. A text mode transfer changed the bytes Copy B4 changes every LF into CRLF. msiinfo and 7-Zip refused it. Download the file again in binary mode. Our script cannot undo this.
5. The file is cut short Copy B2 cuts the file in half, and msiinfo and 7-Zip refused it. Copy B1 removes 512 bytes, and msiinfo refused it while 7-Zip did not. Get a full copy.
6. A stream is damaged Copies C3 to C6 flip one byte in a stream. Our header check printed OK for all four, and 7-Zip read all four as the original. Compare two readers, and get a new copy.
7. Another install or another version Error 1618 means another installation is in progress, per Microsoft. Error 1638 means another version of the product is already installed. Finish the first install, or remove the old version with /x.
8. Error 1603, a fatal error Microsoft says a fatal error occurred during the install. The message does not say which. Write a log with /L*V and read it for the failing action.

What to try first

Read the first bytes Use xxd -l 48 file.msi. Without d0 cf 11 e0 a1 b1 1a e1 the file is not an MSI file.
Use the check script See the script. It flags a broken header, FAT or directory.
Try a second reader msiinfo and 7-Zip agreed on 15 of 21 damaged copies, and 7-Zip and olefile on only 7.
Get a new copy A cut file or a changed stream does not come back. Download it again in binary mode.

A restart is not an error. Microsoft lists 3010 as success with a restart required, and 1641 as success with a restart started. Neither number means the install failed.

How Does an MSI File Differ From EXE, MSP and ZIP Files? One package, three neighbors, compared

An MSI file is a package that stores what to install. An EXE file is a program. A setup program can start an install, but the MSI file is the database that lists the files and steps. An MSP file patches a package.

The table lists the neighbors of an MSI file. We studied MSI, MSP, MST and MSM files, and we studied no EXE, ZIP or DEB file. Their rows are short for that reason.

MSI and its neighbors compared
Type What separates it
MSI An install package, a database of tables and streams, per Wikipedia. 77 of our files, and 76 opened in all three readers.
MSP A patch. All 8 of ours have the root CLSID 000C1086 and Security 4, which Microsoft recommends for patches. Install one with /p.
MST A transform that changes a package. Our 1 file has the CLSID 000C1082.
MSM A merge module, per Wikipedia. We had 3, and 2 opened in all three readers.
EXE A program. The page on EXE programs covers it. We studied none.
ZIP An archive. The page on ZIP archives covers it. 7-Zip opened 87 of our 89 files as a Compound file.

MSI or EXE

An EXE file is a program that starts itself. An MSI file cannot start itself. Windows Installer reads it, and msiexec is the command that does so. A setup program can contain an MSI file, and then two files do one job.

MSI or MSP

A patch changes an installed product, and a package installs it. Microsoft says the Page Count of a patch is Null. Ours show no value, which matches. All 8 patches also say Security 4, read-only enforced.

MSI or ZIP

A ZIP file is a folder in one file. An MSI file also stores files, but it adds tables of steps, settings and shortcuts. 11 of our 76 packages have a Shortcut table. A reader can extract the files, and the install steps stay behind.

Which one do you have

EXE files Read the guide to EXE files for a Windows program.
ZIP files Read the guide to ZIP files for a compressed archive.
DEB files Read the guide to DEB files for a Debian package.
LNK files Read the guide to LNK files for a Windows shortcut file.

What Is the MSI File Format Made Of? The facts we could check, and where they came from

An MSI file stores a header, a FAT, a directory and streams, and most streams are tables. Facts below come from our checks of 89 files and 21 damaged copies. Sources are Wikipedia, Microsoft and the three test tools.

Facts about MSI files
Part What we could check
Maker Microsoft. The service was named Microsoft Installer at first, with the codename Darwin. The first release came on 31 August 1999, per Wikipedia.
Name Windows Installer package, with the endings .msi, .msp, .mst and .msm, per Wikipedia. We did not look up a media type.
First bytes d0 cf 11 e0 a1 b1 1a e1. 68 of our files then read version 62 and 3, and 20 read 62 and 4.
Layout A header of 512 bytes, then a FAT, a directory, a mini stream and streams. Our example has 24 streams, 22 of them tables or strings.
Root CLSID 000C1084 for a package, 000C1086 for a patch and 000C1082 for a transform. 76, 8 and 1 of our files.
Summary Page Count is the minimum installer version, and our 76 packages say 200, 300 or 500. Word Count is a set of flags. Security is 0, 2 or 4, per Microsoft.
Tables The package tables are streams with encoded names that start with U+4840. Our 76 packages have 11 to 89 tables, and the median is 17. All 76 contain _Validation.
Cabinet A cabinet stores the files. A name with a number sign in the Media table means a stream inside. 14 of our packages store one inside and 7 name one outside.
Versions The last release is Windows Installer 5.0 from 22 July 2009, per Wikipedia. 10 of our 76 packages say they need version 5.0.
Our tests 89 files, 21 damaged copies, 3 readers, a check script of 22 lines and a repair script of 10 lines. msiinfo 0.103, 7-Zip 23.01 and olefile 0.47 on Linux.

About the values we list

Facts about the layout come from our own reading of one example file and 89 test files, and from the pages we name. Microsoft's summary pages are the source for the summary values, and Wikipedia is the source for the history.

We read the Microsoft pages for the summary, the validation table, the error codes and msiexec. We did not read the full database reference. We report what we measured, and we make no claim about tables we did not open.

What we left out

We used no Windows machine. We did not install a package, use Orca, check a signature or scan a file for malware. Our readers and scripts worked on Linux, and Windows Installer can accept or refuse files that they treat differently.

All 89 files come from build tools and test folders, and many test one table or one bug. Our damaged copies come from one small file and change one thing at a time. We did not read the rules for custom actions in full.

Sources checked

For the format, see the Wikipedia article on Windows Installer and the Windows Installer overview. For the commands and numbers, see the msiexec reference and the error code list.

For the summary values, see Page Count, Word Count, Security and Template. For the tools, see olefile. The test files come from the WiX 3 repository, the WiX repository, the winget-cli repository and the remoteinstall repository.

Frequently Asked Questions About MSI Files

What is an MSI file?

An MSI file is a Windows Installer package. It stores the files, settings and steps that Windows needs to install one program. The msiexec tool reads it. The format is a loosely relational database built as a COM structured storage, per Wikipedia.

How do I open an MSI file?

Double-click it to start the install, or read it without installing. msiinfo, 7-Zip and olefile opened 87 of our 89 files. msiinfo lists the tables and the summary, and msiextract writes the program files out.

How do I install an MSI file?

Double-click it, or use msiexec /i with the path. Add /passive for a progress bar, /qn for no window and /L*V with a path for a log. These come from Microsoft. We installed no file, because our lab uses Linux.

What is msiexec?

Msiexec is the program that reads a Windows Installer package. Its options include /i to install, /x to uninstall, /a for an administrative install, /p for a patch and /f to repair. We did not test it.

What is the difference between MSI and EXE?

An EXE file is a program that starts itself. An MSI file is a package that Windows Installer reads. A setup program can contain an MSI file. We studied MSI files and not EXE files.

How do I extract an MSI file?

Use msiextract on Linux or 7-Zip. msiextract wrote files from the 14 of our 76 packages that store a cabinet inside, and from none of the others. For an outside cabinet, put the .cab file beside the MSI file.

Can I convert MSI to EXE?

We tested no converter. An MSI file is a package and an EXE file is a program, so the two are not the same kind of file. A setup program that wraps an MSI file is a new file, and we made none.

Why will my MSI file not install?

The file could be damaged, a cabinet could be missing, another install could be in progress or another version could be installed. Read the number Windows Installer prints. Then write a log with /L*V and read the failing action.

What do errors 1619 and 1620 mean?

Both mean the package could not be opened, per Microsoft. Error 1619 says the file could be missing or inaccessible. Error 1620 says it could be an invalid Windows Installer package. Read the first eight bytes.

Is an MSI file safe to open?

Looking at the bytes starts nothing. Installing is the risk, because a package can start code with a custom action. 15 of our 76 packages contain a CustomAction table. We scanned no file for malware.

How can I check if an MSI file is damaged?

Read the first eight bytes, the version, the sector size and the root CLSID, then list the tables with a second tool. Our script flagged or warned on 15 of 21 damaged copies, and 3 of those read as the original. Use two readers.

Can a damaged MSI file be repaired?

Some header damage can be repaired. Our script made 7 of 21 copies match the original byte for byte, and it fixed 4 that readers refused or split on. A cut file, a broken FAT and a changed stream did not come back.

Still Stuck With an MSI File? Where to go next, depending on what went wrong

Your MSI file will not install

Read the first bytes and use the check script. The cause list names what to try in order.

You do not know the kind

The kinds table names the kind, and the neighbors name the formats that look alike.

Is it an EXE file? The EXE file overview covers the Windows program file.

Is it an archive? The ZIP file overview covers the compressed archive.

Is it a Linux package? The DEB file overview covers the Debian package format.

Does the package make a shortcut? 11 of our 76 packages have a Shortcut table. The LNK file overview covers the Windows shortcut file.

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.

Do you need the format facts? Read the format part for the layout, the versions and the sources of MSI files.