Email archive formats, explained
PST · OST · OLM · MBOX · EML · MSG — what each one actually is, and how to get your mail out of it. · First published · updated
Six formats cover almost every email archive a person runs into. They are not variations on a theme: two are proprietary databases, one is a ZIP of XML, one is a text file, one is a single message as text, and one is a single message as a compound binary. Which one you have determines what can open it and what converting it will cost you in fidelity.
This page is a working reference rather than a sales pitch. We wrote a parser for each of these formats to build Mailward, and the details below — including the ones that are awkward for us — are what we learned doing it.
The short version
| Format | What it is | Container | Produced by | Opens with |
|---|---|---|---|---|
| PST | Outlook's personal archive — a single-file database | B-tree database, [MS-PST] | Outlook for Windows (export / archive) | Outlook, XstReader, readpst, Mailward |
| OST | Outlook's offline cache for one mailbox | PST-related container; OST-specific differences | Outlook, automatically, for Exchange / M365 | Outlook (original account only), Mailward |
| OLM | Outlook for Mac's export archive | ZIP of per-message XML | Outlook for Mac (File → Export) | Outlook for Mac, paid converters, Mailward |
| MBOX | One folder of mail as a single text file | Plain text, messages split on “From ” lines | Thunderbird, Apple Mail, Google Takeout | Thunderbird, Apple Mail, most clients, Mailward |
| EML | One message as a standalone file | RFC 5322 headers + MIME body | Almost every mail client (drag a message out) | Thunderbird, Windows Mail, Apple Mail, Mailward |
| MSG | One Outlook item as a standalone file | CFBF/OLE2 compound file of MAPI properties | Outlook for Windows (drag out / Save As) | Outlook for Windows, MsgViewer tools, Mailward |
PST — a database, not a folder of emails
A PST (Personal Storage Table) is a single-file database. Microsoft publishes its layout as the [MS-PST] specification: a node database built from B-trees holding blocks, with a property layer on top that stores each message as a set of typed properties.
The consequence catches people out. There is no email text sitting inside a PST waiting to be copied — a reader has to walk the B-trees, resolve each message's property set, and then reconstruct a standards-compliant RFC 5322 message from those properties. That is why "just rename it" never works, and why converting a PST is a genuine rewrite rather than a repackage.
PST exists in two incompatible variants. The ANSI variant, written by Outlook 97 through 2002, tops out at 2 GB and was notorious for corrupting archives that grew past that ceiling. The Unicode variant arrived with Outlook 2003 and is what essentially every modern .pst uses. A reader that only handles one will fail confusingly on the other.
Reading is not repairing. Mailward does not repair a damaged PST: it reads archives whose header and B-trees are intact and names the ones that are not — an incomplete copy is reported as one, with the size the header records next to the size on disk. Repair is a different problem with its own tools; Outlook for Windows ships one, scanpst.exe (the Inbox Repair Tool). Open a PST file without Outlook → · Convert PST to MBOX → · Convert PST to EML →
OST — an offline cache, tied to an Outlook profile
OST shares much of PST's container structure, but [MS-PST] describes PST. The libpff format reference documents OST-specific differences through reverse engineering. An OST is the offline cache Outlook maintains for one mailbox, created automatically rather than exported on purpose. It may contain only the configured synchronization period or header-only items; a reader cannot recover mail or attachments that were never cached.
The lock people hit is not in the file — it is in Outlook. An OST is bound to the profile and account it belongs to, and Outlook will not open one it cannot associate with a live account. Lose the tenant, leave the company, or decommission the server, and a perfectly healthy file full of your mail becomes unopenable by the only app that normally reads it. Renaming .ost to .pst does not help: Outlook inspects the file, not the extension.
A reader that parses the container format directly never consults that account association. Worth being explicit about what that means: it is a technical capability, not an entitlement. Only open mailbox data you have the right to access. Open an OST file → · Convert OST to MBOX →
OLM — a ZIP of XML that only one app writes
OLM is the least documented format here, so here is what it actually is. An .olm file is a ZIP container. Inside, each message is its own small XML document whose elements carry an OPF prefix — OPFMessageCopySubject, OPFMessageCopyFromAddresses, OPFMessageCopyHTMLBody and so on. Folder hierarchy is expressed by where those documents sit in the archive, and attachments are referenced out of the message XML by an OPFAttachmentURL pointing at another file in the same ZIP.
There is one trap worth knowing if you ever parse one yourself. OLM writes timestamps as UTC but omits the zone suffix entirely, so a value looks like 2022-05-26T17:55:40 with no trailing Z. Parse it as local time and every date in the archive silently shifts by your offset — which is the single most common way an OLM conversion goes quietly wrong. We validated both the element semantics and the timestamp handling against an independent implementation before trusting ours.
Because it is a ZIP of XML rather than a proprietary binary database, an OLM is in some ways easier to read than a PST. The obstacle was never technical difficulty — it is that only Outlook for Mac ever bothered. Windows Outlook will not open one, Apple Mail will not import one, and the commercial converters filling the gap mostly want $40 or your uploaded mailbox. Open an OLM file → · Convert OLM to MBOX →
MBOX — simple, with one sharp edge
MBOX is one plain-text file holding every message in a folder, each introduced by a line beginning with the five characters "From " — the From_ line. That simplicity is why nearly every mail client imports it.
The sharp edge follows directly: if a bare "From " at the start of a line marks a new message, then a body line that genuinely starts that way will split the mailbox in the wrong place unless it is escaped. The variants exist entirely to disagree about how to handle this — mboxo escapes nothing reliably, mboxrd prefixes such lines with >, and mboxcl/mboxcl2 use a Content-Length header instead. Mailward writes mboxrd, because that is what Thunderbird and Apple Mail expect.
MBOX is also what Google Takeout hands you for Gmail: one file, no folder tree (Gmail has no folders), with labels preserved as an X-Gmail-Labels header and threading preserved through ordinary References and In-Reply-To headers. The file arrives inside a .zip or .tgz download. If that download will not open, When a Google Takeout ZIP won't open covers a download that stopped early, a split export and a .tgz. Open an MBOX file →
EML — one message, exactly as it travelled
An .eml file is a single message serialised the way it moved across the network: RFC 5322 headers, a blank line, then a MIME body per RFC 2045. Nothing wraps it and nothing indexes it.
That makes EML the natural unit for review and evidence work — one message is one file, so it can be numbered, hashed, and handed on without carrying the rest of the mailbox with it. It is also where you go to read a message's Received: chain, which is the closest thing email has to a chain of custody. Read it bottom-up: the lowest Received: header is the first server that touched the message, the top one is the last. Reading it the other way round is a common way to reach a confidently wrong conclusion about a forged sender. Open an EML file →
MSG — one message in a CFBF container
A .msg is Outlook for Windows' way of saving one item as a file — drag a message onto the desktop and this is what you get. Unlike EML, it is not text at all: it is a CFBF/OLE2 compound file, the same container old Office documents use, holding a miniature filesystem of storages and streams with one typed MAPI property per stream. The subject, each recipient, and each attachment live in their own named streams.
Two properties routinely mislead people. The stored sender address in corporate mail is often an Exchange X.500 distinguished name (/O=ORG/OU=…), not an email address — the usable SMTP address sits in a separate property. And the internet header block (PR_TRANSPORT_MESSAGE_HEADERS) exists only on messages that arrived from outside: a .msg saved from a sent folder never had headers, so a viewer showing none is reporting a fact, not failing. Older ANSI-variant files add a third trap — their strings are encoded in a Windows codepage the file only hints at through codepage and locale properties, which is why naive parsers turn a Japanese subject into mojibake. Open a MSG file →
Telling them apart from the first bytes
Extensions lie — a file called archive.pst is whatever the tool that wrote it produced. Every one of these formats except EML announces itself in its first bytes, so a hex dump of the start of the file settles the question in seconds. On macOS or Linux, xxd -l 16 file or file file; in PowerShell, Format-Hex -Path file -Count 16.
| Format | First bytes (hex) | What that tells you |
|---|---|---|
| PST / OST | 21 42 44 4E (!BDN) | Bytes 8–9 tell the two apart: “SM” (53 4D) in a PST, “SO” (53 4F) in an OST. Bytes 10–11 are the format version, little-endian: 0E 00 or 0F 00 (14/15) ANSI, 17 00 (23) Unicode, 24 00 (36) Unicode with 4 KB pages; 25 00 (37) marks a Windows Information Protection file, which Mailward refuses. Bytes 4–7 differ from file to file because they are a CRC of the 471 header bytes that follow. Written as PRONOM/DROID signatures, that is 2142444E{4}534D(0E00|0F00) for an ANSI PST (x-fmt/248) and 2142444E{4}534D1700 for a Unicode PST (x-fmt/249); PRONOM has no OST record yet, so the same patterns with 534F in place of 534D identify OST files but do not yet map to a PUID. |
| OLM | 50 4B 03 04 (PK..) | A ZIP. Listing it shows one message_NNNNN.xml per message with the folder as its directory. |
| MSG | D0 CF 11 E0 A1 B1 1A E1 | A CFBF/OLE2 compound file — the same container as a legacy .doc or .xls. |
| MBOX | 46 72 6F 6D 20 (From ) | The From_ envelope line of the first message: “From ”, a sender, then a date. |
| EML | no signature | Starts with a header field — Received:, Return-Path:, From: — a name, a colon, a value. Some Windows tools prepend a UTF-8 byte-order mark (EF BB BF) first. |
Just as useful is recognising the files that are not a mail archive at all but keep arriving with a mail extension. These are the ones we see most often when an open fails:
| Actually is | First bytes (hex) | What to do |
|---|---|---|
| ZIP | 50 4B 03 04 | A zipped backup rather than an OLM — extract it and open the file inside. |
| gzip | 1F 8B | A .gz or .tgz download; Google Takeout offers .tgz as well as .zip. Extract it first. |
| 7-Zip | 37 7A BC AF 27 1C | Extract it first. |
| RAR | 52 61 72 21 1A 07 (Rar!..) | Extract it first. |
| AppleDouble | 00 05 16 07 | A macOS metadata sidecar — the “._archive.pst” that appears next to a file copied to a non-Mac disk or ZIP. Open the file without the “._” prefix. |
| Windows shortcut | 4C 00 00 00 01 14 02 00 … | A .lnk pointing at the real file; the browser received the shortcut, not its target. |
| Outlook Express DBX | CF AD 12 FE | An Outlook Express message store — unrelated to PST, and not a format Mailward reads. |
| tar | 75 73 74 61 72 (ustar) at byte 257 | A Takeout .tgz that was gunzipped but never unpacked: the first 512-byte block is a file header, and the first bytes are the name of the file inside. Extract it, then open that file. |
| SQLite database | 53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00 (SQLite format 3) | A mail client's index, not its messages — Thunderbird's global-messages-db.sqlite, Apple Mail's Envelope Index. The mail is in the mailbox files next to it. |
| Windows program | 4D 5A (MZ) | An .exe or .dll — an installer or a converter that arrived instead of the archive. |
| Web page | 3C 21 44 4F 43 54 59 50 45 (<!DOCTYPE) or 3C 68 74 6D 6C (<html) | What a sharing or download link hands back instead of the file once it needs a sign-in or has expired; the “archive” is the sign-in page. Download it again from the source and check the size. |
| winmail.dat (TNEF) | 78 9F 3E 22 | Outlook's wrapper for one message's rich-text formatting and attachments, sent when Rich Text mail goes to a program that does not read it. Part of a single message, not a mailbox; ask for the mail to be resent as HTML or plain text, or extract the attachments with a TNEF reader. |
| Thunderbird .msf | 2F 2F 20 3C 21 2D 2D 20 3C 6D 64 62 3A 6D 6F 72 6B (// <!-- <mdb:mork) | A Mork summary index of one folder. The messages are in the file of the same name without .msf — Inbox beside Inbox.msf — which has no extension and is an MBOX. |
| Apple Mail .emlx | no signature: a byte count padded with spaces, a line break, then a header | One message with a length line in front and a property list behind, not a mailbox. Apple Mail's Mailbox → Export Mailbox… writes the mailbox as MBOX instead. |
| XML document | 3C 3F 78 6D 6C (<?xml) | Not a mailbox. A message_NNNNN.xml lifted out of an unpacked .olm is one message of an Outlook for Mac export; open the .olm itself. |
| Windows Internet shortcut | 5B 49 6E 74 65 72 6E 65 74 53 68 6F 72 74 63 75 74 5D ([InternetShortcut]) | A saved .url link to the archive, not the archive. Open the link to download the file, then open the download. |
| All zeros | 00 00 00 00 … | A file whose space was reserved but never written — an interrupted download or copy. Nothing can be recovered from it; get the archive again from the source. |
Mailward runs exactly this check on the first bytes before it picks a reader. A file whose name says .pst — or has no extension Mailward recognises — but whose content starts with a message header, an mbox From separator or the Compound File signature is opened as EML, MBOX or MSG directly, no renaming needed. When a file still refuses to open, the error message says what it actually is and the fix — extract it, pick the real file, or download it again. Only that verdict is ever recorded, never the bytes; it is how we can tell that most failed opens are wrong-file cases rather than parser bugs.
Which format should you convert to?
If the mail needs to move into Thunderbird or Apple Mail, convert to MBOX. Thunderbird can import it into Local Folders with ImportExportTools NG; Apple Mail provides File → Import Mailboxes. Each MBOX holds one folder's messages. Re-create any nested folder structure in the destination client and check the result before removing the source.
If each message has to stand alone — discovery, review sets, evidence, or moving a handful of specific messages — convert to EML. One file per message is the whole point.
Writing PST requires a dedicated implementation of its database format. Outlook and PST-writing libraries such as Aspose.Email can create PST files; [MS-PST] documents both reading and writing. Mailward exports MBOX and EML, not PST. Choose a PST-capable tool if your destination specifically requires an Outlook data file.
How to move an MBOX into Gmail
Gmail's web interface has no MBOX file-upload importer. Google Takeout exports your Gmail data; it does not put an archive back into an account. A mail client can bridge the gap:
- Import the MBOX into Thunderbird's Local Folders using ImportExportTools NG, or into Apple Mail using File → Import Mailboxes.
- Add your Gmail account to that client using Sign in with Google. For a managed Workspace account, check that the administrator permits the connection.
- Copy a small batch from the local mailbox into a folder under the Gmail account. Allow the IMAP synchronization to finish.
- Check Gmail on the web for the messages, dates and attachments, then copy the rest in batches. Keep the original archive until you have verified the migration.
For Google Workspace, Google also provides GWMMO, which can import PST files directly under its supported setup. That is a separate route from converting to MBOX. See Google's PST import instructions and Gmail client setup. Mailward creates the local export; it does not connect to or migrate your Gmail account.
What gets lost in conversion — honestly
Every format change loses something, and the useful question is what. Moving from a property-database format (PST, OST) or a structured XML archive (OLM) into MIME means each message is rebuilt rather than copied, so it is worth knowing where the edges are:
- Headers and body text reconstruct faithfully — this is the part standards cover well.
- Attachments are the usual casualty in careless converters. A faithful export re-embeds them as base64 MIME parts, which is what Mailward's EML and MBOX output does — each exported message is a complete, standalone MIME document with its files inside. Separate per-message saving and whole-archive ZIP extraction remain for when you want files without mail.
- Outlook-specific properties — categories, flags, some calendar and contact fields — have no MIME equivalent and do not survive. No converter fixes this; the target format simply has nowhere to put them.
- Timestamps survive if the reader interprets the source correctly. See the OLM note above for the classic failure.
Why do this in a browser at all?
Email archives are among the most sensitive files a person owns, and the conventional options for opening one are to install and license Outlook, or to upload years of private correspondence to a free online converter. Modern browsers make a third option possible: the File API hands a local file to a Web Worker, the parsing happens on your own machine, and nothing is transmitted. You can load the page, disconnect from the network, and keep working.
The honest trade-off is headroom. A native application has memory a browser tab does not — and a tab cannot even hold a string longer than about 512 MB, V8's hard limit — which is why Mailward streams PST and OST files in pages rather than loading them whole, and why its MBOX reader scans the file once in 4 MB chunks, keeps only each message's byte range and listing, and parses a message when you open it. A 1.3 GB, 198,000-message Takeout export opens this way; a body search across it re-reads messages as it goes and reports progress. (Listing and search of the whole file are free; reading messages past the first 500 MB is part of the Pro licence.)
Sources and specifications
The claims above were checked against the documents below. Where something rests on reverse-engineering rather than a published specification — the OST content type, the 4 KB page layout, everything about OLM — the text says so, and the source that establishes it is listed here so you can check it yourself.
- Microsoft: Only a subset of Exchange mailbox items is synchronized — Cached Exchange Mode may retain only the configured period of mail in the OST; older messages can remain on the server.
- Microsoft: Managing a message in an OST without synchronization — An OST entry can contain only a downloaded header. A direct reader cannot reconstruct an uncached message body from that header.
- Aspose.Email: Creating and managing PST files — An example of a dedicated library that writes PST files; Outlook is not the only PST producer.
- [MS-PST]: Outlook Personal Folders (.pst) File Format — Microsoft's public specification of the PST container: the header (section 2.2.2.6, where the version byte and the ANSI/Unicode split are defined), the B-trees, and the property model. It is written for PST; it does not describe OST.
- libpff: Personal Folder File (PFF) format documentation — Joachim Metz's reverse-engineered documentation, which covers what [MS-PST] leaves out: the SM / SO / AB content types at bytes 8–9 that tell a PST from an OST, and the version-36 layout with 4 KB pages.
- PRONOM x-fmt/248 (ANSI PST) and x-fmt/249 (Unicode PST) — The UK National Archives' format registry records for the two PST layouts, with the byte signatures DROID and Siegfried match on: 2142444E{4}534D(0E00|0F00) for x-fmt/248 and 2142444E{4}534D1700 for x-fmt/249 (the {4} skips the per-file CRC). There is no OST record; a proposal to add one — the same signatures with 534F, plus 534F2400 for the 4 KB-page layout — is open in the PRONOM_Research tracker at github.com/digital-preservation/PRONOM_Research/issues/168.
- [MS-OXMSG]: Outlook Item (.msg) File Format — How a single Outlook item's MAPI properties are laid out as named streams inside a compound file.
- [MS-CFB]: Compound File Binary File Format — The OLE2 container that .msg files (and legacy .doc / .xls) sit in, and the origin of the D0 CF 11 E0 signature.
- RFC 5322: Internet Message Format — The message and header syntax an EML file is. Everything else on this page converts towards it.
- RFC 2045: MIME Part One — Multipart bodies and the base64 / quoted-printable encodings that carry attachments inside an EML or MBOX message.
- RFC 4155: The application/mbox Media Type — The closest thing MBOX has to a standard. It registers the media type and describes the From-line framing, but does not settle how a literal “From ” inside a body is escaped — which is why the mboxo and mboxrd variants both exist.
- Export items to an archive file in Outlook for Mac — Microsoft's user documentation for OLM. There is no published OLM format specification; what this page says about the ZIP-of-XML layout and the timestamps comes from reading exported files.
- How to download your Google data (Google Takeout) — Google's documentation of the export that produces the MBOX files most people meet, labels included.
- pst-extractor, msgreader and postal-mime — The open-source parsers Mailward's PST/OST, MSG and MBOX/EML readers are built on (msgreader: github.com/HiraokaHyperTools/msgreader; postal-mime: github.com/postalsys/postal-mime). The OLM reader is our own.
Try it on your own file → · About Mailward · Corrections welcome