What is a .msg file?

A technical explanation of Outlook's .msg format: the OLE2 container, MAPI property streams, how bodies are stored, and why other applications cannot read it.

A .msg file is Microsoft Outlook's format for storing a single Outlook item as a standalone file. Despite the name, it holds more than email: an appointment, contact, task, note or meeting request saved from Outlook all produce a .msg file.

The container: Compound File Binary Format

Internally, a .msg file is an OLE2 Compound File — effectively a small filesystem inside a single file, with directories ("storages") and files ("streams"). Every such file begins with the same eight signature bytes, D0 CF 11 E0 A1 B1 1A E1, which is how a reader can identify one regardless of its extension.

The same container format underlies legacy .doc, .xls and .ppt files. What differs is the naming and meaning of the streams inside, which for .msg is specified by [MS-OXMSG].

What is stored inside

Each message property lives in its own stream named after a MAPI property tag — a 16-bit property id plus a 16-bit type. For example:

PropertyTagHolds
PidTagSubject0037001FThe subject line
PidTagBody1000001FPlain-text body
PidTagHtml10130102HTML body, as raw bytes
PidTagRtfCompressed10090102Compressed RTF body
PidTagSenderEmailAddress0C1F001FSender address

Recipients and attachments are not properties but sub-storages — __recip_version1.0_#00000000, __attach_version1.0_#00000000 and so on — each with its own property streams inside.

The three ways a body can be stored

This is where most simple viewers fail, and why the same file can look perfect in one tool and blank in another. Outlook may store the body as:

  • Plain text in PidTagBody.
  • HTML in PidTagHtml, as raw bytes that must be decoded using the code page named in PidTagInternetCodepage. Decoding these as UTF-8 by default is what produces mojibake in Chinese, Japanese, Korean, Cyrillic and Greek messages.
  • Compressed RTF in PidTagRtfCompressed. When the message was originally HTML, Outlook wraps that HTML inside the RTF using the [MS-OXRTFEX] encapsulation scheme. Recovering it requires decompressing the stream and then de-encapsulating \htmltag and \htmlrtf control words. Viewers that skip this step show an empty body for a large share of real-world Outlook mail.

Inline images and cid: references

Images that appear inside the message body are stored as ordinary attachments carrying a PidTagAttachContentId. The HTML body then references them as <img src="cid:image001.png@01D9…">. A viewer has to match each cid: reference to its attachment and substitute a usable URL; otherwise the message renders with broken image placeholders where the signature and logos should be.

Why other applications will not open it

Microsoft documented the format but never proposed it as an interchange standard, and it encodes Exchange-specific concepts — legacy distinguished names, voting buttons, delegate information, message classes — that have no equivalent in standard internet mail. Supporting it means implementing a Microsoft specification with no benefit to a competitor's own format, so almost nobody does.

The standard alternative is .eml, which is plain RFC 822 text. Compare the two formats to see what you gain and lose by converting.

Open a .msg file right now

No sign-up, no upload, no software to install.

Open the viewer