Introduction
A PST file, short for Personal Storage Table, holds a whole mailbox for
Microsoft Outlook: folders,
emails, calendar items, contacts and tasks. People use it to archive old mail, to move a
mailbox to another computer, and with POP email accounts, where Outlook keeps all mail in
a PST file. An OST file (.ost) is the same format used as an offline copy of
an Exchange or Microsoft 365 mailbox.
Older ANSI files, from before Outlook 2003, are limited to 2 GB. Unicode files, the default since Outlook 2003, use 64-bit offsets and can be far larger. Microsoft published the format as [MS-PST] in 2010.
Structure
The file starts with the magic !BDN, then a client signature,
SM for a PST or SO for an OST, and a version number: 14 or 15
for ANSI files, 23 for Unicode. The format has three layers:
- Node database: the file is cut into pages and blocks, found through two B-trees, one for nodes and one for blocks. Data blocks are usually lightly obfuscated with a simple byte substitution.
- Lists, tables and properties: inside the nodes, a small heap format stores property contexts, each a set of properties of one item, and table contexts, each a table such as the contents of a folder.
- Messaging: on top, folders, messages, recipients and attachments, each a node with its properties, using the same property IDs as an MSG file.
The header and node database and heaps, tables and messaging pages give the structures field by field.
Viewer
Drop a .pst or .ost file on the viewer. A file is never read whole: it opens by its
header, the root pages of the two B-trees and the message store, so a file of many gigabytes opens at once. The
Structure tree is the file on disk: the header field by field, the reserved
area, the density list, and then the data sections of 253,952 bytes, each opened on demand into its allocation map,
its B-tree pages and its blocks, each read for what it is (a page, or a block whose size, signature and CRC check out,
or bytes that are neither, said so).
The tabs show the mailbox. Overview: the file type (ANSI or Unicode, PST or OST), the encoding of
the data blocks, the checks of the header, the two B-trees and the message store. Folders: every folder,
depth first from the root folder, with the counts its own properties give and the rows its contents table holds.
Messages: the messages of the folder chosen in the options bar, a page at a time; Open shows a message as
an .eml file (made from its properties: a message is not stored as Internet text). Set the option
Message number to a row of that list to show the message in full: Message,
Message properties (every property, by tag, name, type, where it is held, size and value; a tag the
viewer has no name for is shown by its hex tag and type, never dropped), Recipients,
Attachments (each held by value opens as a file, an embedded message as an .eml file) and
Body (plain text, HTML, and compressed RTF decompressed with
[MS-OXRTFCP]). Store: the properties of the message
store. Named properties: the name-to-ID map. Search folders: the search folders and
the search objects at their fixed node IDs, listed. Nodes and Blocks: the leaf
entries of the two B-trees, a page at a time. Allocation: one row per allocation map.
The property names are the ones the MSG viewer has, written by hand from [MS-OXPROPS]. The three encodings (none, permutation and cyclic) are decoded, ANSI and Unicode files are read, and the node and block B-trees may have any number of levels, data trees two levels (XBLOCK and XXBLOCK) and subnode trees two (SLBLOCK and SIBLOCK).
At open the viewer reads and checks up to 2,000 pages of each B-tree (the trailer, the signature, the CRC, that every block and page the trees name lies inside the file and is marked allocated in its allocation map, for the first 32 allocation maps); the rest of a tree is checked as it is read, a block when it is read (its trailer and CRC), and a problem found then is added to the list marked as found after opening. Every problem is listed, none is dropped.
Not described
The pages follow [MS-PST] (the 2025-02-18 edition) and, for the 4 KB variant, the libpff documentation.
The templates page covers [MS-PST] 2.4 (required properties and every column of the template tables) and 2.5 (calculated properties); the maintenance page covers 2.6.1.3, 2.6.2, 2.6.3 and 2.7 (the minimal file).
Known, not yet covered
- Viewer: the 4 KB page variant (OST format 36, Outlook 2013 and later): only its header is shown, because the layout is third-party documentation with unknown parts (see the reference note under Unknown); the viewer says so as a problem.
- Viewer: files with bCryptMethod 16 (Windows Information Protection, wVer 37): the data blocks are not decoded, so nothing above the node database is shown.
- Viewer: the property names are the hand-written subset the MSG viewer has (about 160 tagged and named properties), not all of [MS-OXPROPS]; every other property is shown by its hex tag and type.
- Viewer: items are shown as properties: a calendar item, contact, task or distribution list is not
rendered as a calendar, a contact card or a list, and a message is opened as an
.emlmade from its properties, not as the original. - Viewer: the folders listed are those reachable from the root folder; folder nodes that no hierarchy table names, associated (folder information) contents tables and the template tables are not listed as messages (the Nodes tab lists every node).
- Viewer: the allocation check at open covers the first 32 allocation maps and the first 2,000 pages of each B-tree; the rest is checked as it is read, not at open. The Allocation tab reads any map.
- Viewer: the password in PidTagPstPassword is shown as the CRC it is; it is not checked against a password, because none is asked for (it protects nothing: the data is readable).
Unknown
- Viewer: tables whose heap has a client signature [MS-PST] reserves without describing it (Outlook writes the search contents table of some search folders with 0xAC): they are listed as not decoded.
- Viewer: the content of search criteria objects and of the search gatherer descriptor: [MS-PST] says they are out of its scope, so the viewer lists them with their sizes and does not read them.
- Reference: the 4 KB-page (format 36, OST) free map and density list bodies, the unknown 8 bytes in its page trailer and 4 bytes in its block trailer, and whether encryption is applied before or after compression: [MS-PST] does not describe this variant and libpff marks them unknown.
- Reference: the content of search criteria objects and of the search gatherer descriptor: [MS-PST] says they are out of its scope.
Links
Software
- Microsoft Outlook – Microsoft’s email program, which creates, opens and imports data files (Windows)
Developers
- libpff – reads PST and OST files, with Python bindings (C, Python)
- java-libpst – reads PST files (Java)
Reference
- [MS-PST]: Outlook Personal Folders (.pst) File Format – Microsoft’s published specification, in its Open Specifications