The lowest layer of a PST file, the node database (NDB), as described in Microsoft’s [MS-PST] (read 2026-11-12). It stores nodes (identified by NIDs) whose data lives in blocks (identified by BIDs), and finds both through two B-trees. Numbers are little-endian. Unicode files use 64-bit IDs and offsets; ANSI files use 32-bit ones.
Header
| Unicode | ANSI | Size (U / A) | Field |
|---|---|---|---|
0 | 0 | 4 | dwMagic: !BDN (21 42 44 4E). |
4 | 4 | 4 | dwCRCPartial: CRC of the 471 bytes from offset 8. |
8 | 8 | 2 | wMagicClient: SM (53 4D). |
10 | 10 | 2 | wVer: 14 or 15 ANSI; 23 or more Unicode; 37 means written by an Outlook that supports Windows Information Protection. |
12 | 12 | 2 | wVerClient: 19. |
14 | 14 | 1 | bPlatformCreate: 1. |
15 | 15 | 1 | bPlatformAccess: 1. |
16 | 16 | 4 | dwReserved1. |
20 | 20 | 4 | dwReserved2. |
24 | – | 8 | bidUnused (Unicode). |
32 | 28 | 8 / 4 | bidNextP: next page BID to allocate. |
| – | 24 | 4 | bidNextB (ANSI position). |
40 | 32 | 4 | dwUnique: increased every time the header changes, so the CRCs differ. |
44 | 36 | 128 | rgnid: 32 NIDs, one per NID type: the last nidIndex allocated. A new file starts normal folders and other types at 400, search folders at 4000, normal messages at 10000 and associated messages at 8000 (hex). |
172 | – | 8 | qwUnused (Unicode). |
180 | 164 | 72 / 40 | root: ROOT. |
252 | – | 4 | dwAlign (Unicode). |
256 | 204 | 128 | rgbFM: deprecated free map, FF bytes. |
384 | 332 | 128 | rgbFP: deprecated free page map, FF bytes. |
512 | 460 | 1 | bSentinel: 80. |
513 | 461 | 1 | bCryptMethod: see encryption. |
514 | 462 | 2 | rgbReserved. |
516 | – | 8 | bidNextB: next block BID (Unicode position). |
524 | – | 4 | dwCRCFull: CRC of the 516 bytes from offset 8 (Unicode). |
| – | 464 | 8 + 4 | ANSI: ullReserved, dwReserved. |
528 | 476 | 3 | rgbReserved2. |
531 | 479 | 1 | bReserved. |
532 | 480 | 32 | rgbReserved3. |
The CRC is [MS-PST]’s CRC-32: the usual reflected table (77073096,
EE0E612C, …), seeded with 0 and not inverted at the end.
ROOT
| Field | Size (U / A) | Meaning |
|---|---|---|
dwReserved | 4 | |
ibFileEof | 8 / 4 | File size. |
ibAMapLast | 8 / 4 | Offset of the last allocation map page. |
cbAMapFree | 8 / 4 | Free space in all AMaps. |
cbPMapFree | 8 / 4 | Free space in all PMaps (deprecated). |
BREFNBT | 16 / 8 | BID and offset of the root page of the node B-tree. |
BREFBBT | 16 / 8 | The same for the block B-tree. |
fAMapValid | 1 | 0 the AMaps are not valid; 2 valid; 1 valid but deprecated. |
bReserved, wReserved | 1, 2 |
Encryption
bCryptMethod: 00 none; 01 permutation (a
fixed byte substitution table); 02 cyclic (a symmetric cipher keyed by
the low 32 bits of the block’s BID); 10 Windows Information Protection.
Only the data field of data blocks is encoded; padding, trailers, the header,
allocation pages and B-tree pages are not. [MS-PST] calls the two ciphers keyless
obfuscation that is easily decoded.
Node and block IDs
- NID, 32 bits: bits 0–4
nidType, bits 5–31nidIndex. - BID, 64 bits (ANSI 32): bit 0 reserved, bit 1 set for internal blocks (XBLOCKs and subnode blocks), the rest an index, so block BIDs grow by 4. Page BIDs use all the bits and grow by 1.
- BREF: a BID and the byte offset of the block or page.
| nidType | Name | nidType | Name |
|---|---|---|---|
00 | HID (heap ID) | 0B | RECEIVE_FOLDER_TABLE |
01 | INTERNAL | 0C | OUTGOING_QUEUE_TABLE |
02 | NORMAL_FOLDER | 0D | HIERARCHY_TABLE |
03 | SEARCH_FOLDER | 0E | CONTENTS_TABLE |
04 | NORMAL_MESSAGE | 0F | ASSOC_CONTENTS_TABLE |
05 | ATTACHMENT | 10 | SEARCH_CONTENTS_TABLE |
06 | SEARCH_UPDATE_QUEUE | 11 | ATTACHMENT_TABLE |
07 | SEARCH_CRITERIA_OBJECT | 12 | RECIPIENT_TABLE |
08 | ASSOC_MESSAGE | 13 | SEARCH_TABLE_INDEX |
0A | CONTENTS_TABLE_INDEX | 1F | LTP |
Special internal NIDs: 21 message store, 61 named
property map, A1 normal folder template, C1 search folder
template, 122 root folder, 1E1 search management queue,
201 search activity list, 241 reserved, 261
search domain object, 281 search gatherer queue, 2A1
search gatherer descriptor, 2E1 and 301 reserved,
321 search gatherer folder queue.
Pages
Pages are 512 bytes and end with a trailer (16 bytes Unicode, 12 ANSI):
ptype (1), ptypeRepeat (1, the same), wSig
(2, zero for map pages, a computed signature for B-tree and density list pages),
then dwCRC (4) of the page data and the page’s BID; ANSI files put the
BID before the CRC. Map pages use their file offset as their BID.
| ptype | Page |
|---|---|
80 | BBT page (block B-tree) |
81 | NBT page (node B-tree) |
82 | FMap page (deprecated) |
83 | PMap page (deprecated) |
84 | AMap page: one bit per 64 bytes of the following 253,952 bytes |
85 | FPMap page (deprecated) |
86 | Density list page |
The first AMap page is at offset 4400, then every 253,952 bytes.
B-tree pages
Entries fill the page; at the end, before the trailer: cEnt (1),
cEntMax (1), cbEnt (1, entry size), cLevel
(1, 0 for leaves), and in Unicode 4 padding bytes.
| Entry | Fields (Unicode sizes) |
|---|---|
| Intermediate (BTENTRY) | Key (8), BREF of the child page (16). |
| NBT leaf (NBTENTRY) | NID (8, padded), bidData (8), bidSub (8, subnode tree or 0), nidParent (4), padding (4). |
| BBT leaf (BBTENTRY) | BREF (16), cb (2, data size), cRef (2, reference count), padding (4). |
Blocks
A block is its data, padding to a multiple of 64 bytes, and a trailer (16 bytes
Unicode, 12 ANSI): cb (2, data size), wSig (2),
dwCRC (4, of the cb data bytes) and bid, with
bid before dwCRC in ANSI files. Blocks are 64 to 8,192
bytes.
| Block | Layout |
|---|---|
| Data block | The node’s bytes, encrypted as bCryptMethod says. |
| XBLOCK | btype 1, cLevel 1, cEnt (2), lcbTotal (4, total size), then cEnt BIDs of data blocks: for data larger than one block. |
| XXBLOCK | As XBLOCK with cLevel 2; its BIDs point to XBLOCKs. |
| SLBLOCK | btype 2, cLevel 0, cEnt (2), padding (4), then entries: NID (8), bidData (8), bidSub (8). The node’s subnodes. |
| SIBLOCK | btype 2, cLevel 1, then entries: NID (8), BID of an SLBLOCK (8). |
Above this layer, nodes hold heaps, tables and property contexts.
Allocation pages
From [MS-PST] 2.2.2.7.2 to 2.2.2.7.6 and 2.6.1.1 (read 2026-11-13). Every map page is
a 512-byte page (data 496 bytes, then the trailer; an ANSI page has 4 zero bytes
of padding first). Their trailer wSig is 0 and their BID is their own
file offset.
| Page | ptype | Layout and rules |
|---|---|---|
| AMap | 84 | rgbAMapBits, 496 bytes: bit n (most significant bit first within a byte: bit 0 is the 0x80 bit of the first byte; checked on the files Outlook itself wrote, where every block and page the B-trees name is marked this way and none the other way round) is 1 when the nth 64-byte slot of the data section it maps is allocated. One AMap maps 253,952 bytes (496 × 8 × 64), and sits at the start of that section, so it maps itself: its first byte is FF (the first 512 bytes are the AMap). The first AMap is at file offset 0x4400, then every 253,952 bytes. It is the authoritative record of free space and must always be kept right. |
| PMap | 83 | Like the AMap but one bit per 512-byte page, so one PMap per eight AMaps, covering 2,031,616 bytes (496 × 8 × 512). It pre-allocates 4 KB (eight pages) from the AMap at a time and zeroes the matching PMap byte; a 0 bit is a page free to take, and a 1 bit is ambiguous and should be ignored. First at 0x4600. Deprecated in favour of the density list, but must be present at the right intervals with valid checksums for older clients. |
| FMap | 82 | One byte per AMap page: the longest run of free 64-byte slots in it (counted up to 16 KB). A page of 496 bytes covers about 125 MB. The header's initial FMap is only 128 bytes. Should not be used, but must be present at the right intervals. |
| FPMap | 85 | Unicode only. One bit per PMap page: 0 means that PMap page has free pages, 1 none. A page covers about 8 GB. The header holds a 128-byte initial FPMap; ANSI files have only that one. Should not be used, but must be present at the right intervals. |
| Density list (DList) | 86 | At most one, at offset 0x4200, in the reserved area that other transient processes can overwrite; if its CRC is bad do not use it, and rebuild it from the AMaps. Fields: bFlags (1; 01 = DFL_BACKFILL_COMPLETE, no backfill in progress), cEntDList (1, how many entries are valid), wPadding (2), ulCurrentPage (4: the AMap page index for the next allocation if backfill is complete, otherwise the one tried for backfilling), then rgDListPageEnt (476 bytes Unicode, 480 ANSI), 12 bytes of padding, the trailer. An entry is 32 bits: dwPageNum (20 bits: the zero-based AMap index) and dwFreeSlots (12 bits: the number of free 64-byte slots in it, not necessarily contiguous). The list is in order of descending free space. |
Rules for writers ([MS-PST] 2.6.1.1): check fAMapValid in the header
before allocating; no allocation may exceed 8 KB; update the AMap and
cbAMapFree and cbPMapFree in the header; the file grows in
whole multiples of the AMap span (about 250 KB), with new AMaps (and PMaps, FMaps and
FPMaps at their intervals) initialised, and ibFileEof,
ibAMapLast, cbAMapFree, cbPMapFree updated.
The header and these allocation pages are the only structures ever changed in place;
everything else is copy-on-write. The DList, PMap, FMap and FPMap are optimisations
that may be left alone.
Rules for changing a file
[MS-PST] 2.6.1.1 and 2.6.1.2 (read 2026-11-13). Existing pages and blocks are never edited in place; a changed one is written anew and its parents are rewritten up the tree.
- Page: 512 bytes on a 512-byte boundary; trailer filled in; the BBT updated;
bidNextBandbidNextPincremented. Freeing drops the BID's reference count and frees the space when it falls below 2. - Block: a multiple of 64 bytes on a 64-byte boundary, counting the trailer; data of non-internal blocks encoded per
bCryptMethod; reference count initialised in the BBT; trailer and CRC set. - Modifying a block or page means creating a new one, replacing the references to the old BID (recursively up through data trees and B-trees) and dropping the old one's count. New data is always a new block, even when it is no larger than the old.
- New node: allocate data blocks (a data tree above 8 KB), add it to the NBT and increment
rgnid[nidType]in the header; keep B-tree pages under 90 percent full. A subnode's NID is internal and is not taken fromrgnid. - Copying a node (for instance a message attached to another message) raises the BBT reference count of its
bidDataandbidSubso that both nodes share the blocks, without touching the counts of child blocks. - Deleting drops those reference counts and removes the NBT or subnode entry.
Signature and checksums
The wSig of a BBT, NBT or density-list page, and of a block, is
computed from the item's file offset ib and its BID:
x = ib XOR bid, wSig = (x >> 16) XOR (x & 0xFFFF)
(16-bit result). The CRC is the one under
Header, computed over the page or block data without the trailer
and without the padding.
The two encodings
[MS-PST] 5.1 and 5.2 give the code. Both work on the data of a data block, in place.
The permutation uses one 768-byte table, split in three 256-byte tables:
mpbbR is bytes 0–255 (encode), mpbbS bytes 256–511
and mpbbI bytes 512–767 (decode). bCryptMethod
01 replaces each byte b by mpbbR[b], and decoding
by mpbbI[b]. 02 (cyclic) is symmetric: the key is the low
32 bits of the block's BID, w = (key XOR (key >> 16)) as a 16-bit
value, and for each byte b:
b = b + (w & 0xFF)
b = mpbbR[b]
b = b + (w >> 8)
b = mpbbS[b]
b = b - (w >> 8)
b = mpbbI[b]
b = b - (w & 0xFF)
w = w + 1 (16-bit)
All arithmetic on bytes wraps modulo 256. The table, in 8 values per line, first
mpbbR (32 lines), then mpbbS, then mpbbI:
mpbbR
65, 54, 19, 98, 168, 33, 110, 187,
244, 22, 204, 4, 127, 100, 232, 93,
30, 242, 203, 42, 116, 197, 94, 53,
210, 149, 71, 158, 150, 45, 154, 136,
76, 125, 132, 63, 219, 172, 49, 182,
72, 95, 246, 196, 216, 57, 139, 231,
35, 59, 56, 142, 200, 193, 223, 37,
177, 32, 165, 70, 96, 78, 156, 251,
170, 211, 86, 81, 69, 124, 85, 0,
7, 201, 43, 157, 133, 155, 9, 160,
143, 173, 179, 15, 99, 171, 137, 75,
215, 167, 21, 90, 113, 102, 66, 191,
38, 74, 107, 152, 250, 234, 119, 83,
178, 112, 5, 44, 253, 89, 58, 134,
126, 206, 6, 235, 130, 120, 87, 199,
141, 67, 175, 180, 28, 212, 91, 205,
226, 233, 39, 79, 195, 8, 114, 128,
207, 176, 239, 245, 40, 109, 190, 48,
77, 52, 146, 213, 14, 60, 34, 50,
229, 228, 249, 159, 194, 209, 10, 129,
18, 225, 238, 145, 131, 118, 227, 151,
230, 97, 138, 23, 121, 164, 183, 220,
144, 122, 92, 140, 2, 166, 202, 105,
222, 80, 26, 17, 147, 185, 82, 135,
88, 252, 237, 29, 55, 73, 27, 106,
224, 41, 51, 153, 189, 108, 217, 148,
243, 64, 84, 111, 240, 198, 115, 184,
214, 62, 101, 24, 68, 31, 221, 103,
16, 241, 12, 25, 236, 174, 3, 161,
20, 123, 169, 11, 255, 248, 163, 192,
162, 1, 247, 46, 188, 36, 104, 117,
13, 254, 186, 47, 181, 208, 218, 61,
mpbbS
20, 83, 15, 86, 179, 200, 122, 156,
235, 101, 72, 23, 22, 21, 159, 2,
204, 84, 124, 131, 0, 13, 12, 11,
162, 98, 168, 118, 219, 217, 237, 199,
197, 164, 220, 172, 133, 116, 214, 208,
167, 155, 174, 154, 150, 113, 102, 195,
99, 153, 184, 221, 115, 146, 142, 132,
125, 165, 94, 209, 93, 147, 177, 87,
81, 80, 128, 137, 82, 148, 79, 78,
10, 107, 188, 141, 127, 110, 71, 70,
65, 64, 68, 1, 17, 203, 3, 63,
247, 244, 225, 169, 143, 60, 58, 249,
251, 240, 25, 48, 130, 9, 46, 201,
157, 160, 134, 73, 238, 111, 77, 109,
196, 45, 129, 52, 37, 135, 27, 136,
170, 252, 6, 161, 18, 56, 253, 76,
66, 114, 100, 19, 55, 36, 106, 117,
119, 67, 255, 230, 180, 75, 54, 92,
228, 216, 53, 61, 69, 185, 44, 236,
183, 49, 43, 41, 7, 104, 163, 14,
105, 123, 24, 158, 33, 57, 190, 40,
26, 91, 120, 245, 35, 202, 42, 176,
175, 62, 254, 4, 140, 231, 229, 152,
50, 149, 211, 246, 74, 232, 166, 234,
233, 243, 213, 47, 112, 32, 242, 31,
5, 103, 173, 85, 16, 206, 205, 227,
39, 59, 218, 186, 215, 194, 38, 212,
145, 29, 210, 28, 34, 51, 248, 250,
241, 90, 239, 207, 144, 182, 139, 181,
189, 192, 191, 8, 151, 30, 108, 226,
97, 224, 198, 193, 89, 171, 187, 88,
222, 95, 223, 96, 121, 126, 178, 138,
mpbbI
71, 241, 180, 230, 11, 106, 114, 72,
133, 78, 158, 235, 226, 248, 148, 83,
224, 187, 160, 2, 232, 90, 9, 171,
219, 227, 186, 198, 124, 195, 16, 221,
57, 5, 150, 48, 245, 55, 96, 130,
140, 201, 19, 74, 107, 29, 243, 251,
143, 38, 151, 202, 145, 23, 1, 196,
50, 45, 110, 49, 149, 255, 217, 35,
209, 0, 94, 121, 220, 68, 59, 26,
40, 197, 97, 87, 32, 144, 61, 131,
185, 67, 190, 103, 210, 70, 66, 118,
192, 109, 91, 126, 178, 15, 22, 41,
60, 169, 3, 84, 13, 218, 93, 223,
246, 183, 199, 98, 205, 141, 6, 211,
105, 92, 134, 214, 20, 247, 165, 102,
117, 172, 177, 233, 69, 33, 112, 12,
135, 159, 116, 164, 34, 76, 111, 191,
31, 86, 170, 46, 179, 120, 51, 80,
176, 163, 146, 188, 207, 25, 28, 167,
99, 203, 30, 77, 62, 75, 27, 155,
79, 231, 240, 238, 173, 58, 181, 89,
4, 234, 64, 85, 37, 81, 229, 122,
137, 56, 104, 82, 123, 252, 39, 174,
215, 189, 250, 7, 244, 204, 142, 95,
239, 53, 156, 132, 43, 21, 213, 119,
52, 73, 182, 18, 10, 127, 113, 136,
253, 157, 24, 65, 125, 147, 216, 88,
44, 206, 254, 36, 175, 222, 184, 54,
200, 161, 128, 166, 153, 152, 168, 47,
14, 129, 101, 115, 228, 194, 162, 138,
212, 225, 17, 208, 8, 139, 42, 242,
237, 154, 100, 63, 193, 108, 249, 236
The 4 KB page variant (OST, format 36)
[MS-PST] describes only 512-byte pages and gives no layout for this variant; it says a
Unicode file has wVer greater than 23 (and 37 for a WIP-capable Outlook).
What follows is third-party documentation, the libpff
Personal Folder File (PFF) format
by Joachim Metz (read 2026-11-13), which marks parts of it as unknown. Format 36
(“64-bit Unicode with 4k pages”, first seen in Outlook 2013 OST files) uses
4,096-byte pages; the content type (client signature) SO marks an OST,
SM a PST, AB a PAB.
| Structure | Layout in the 4 KB variant, as libpff documents it |
|---|---|
| Page | 4,072 bytes of data, then ptype (1), ptypeRepeat (1), wSig (2), CRC-32 of the first 4,072 bytes (4), back pointer BID (8), and 8 bytes of unknown use: a 24-byte trailer. |
Allocation page (84) | 4,072 bytes of bit data, then the 24-byte trailer. The first one is at offset 0x22000; they repeat every 4,072 × 8 × 512 = 16,678,912 bytes. A 83 page has not been seen in this variant. |
| B-tree page | 4,056 bytes of entries (at most 488), then cEnt (2), cEntMax (2), cbEnt (1), cLevel (1), 10 bytes of padding, then the 24-byte trailer. The entries are the same as in the 512-byte page. |
Density list (86) | Seen at offset 0x21000; the body layout is not documented, the trailer is the 24-byte one. |
| Free map | Not documented ("not seen so far"). |
| Block | Data, padding to a multiple of 512 bytes, then a 24-byte trailer: cb (2), wSig (2), CRC-32 (4), BID (8), 2 bytes whose value is 2 and use is unknown, the uncompressed data size (2), and 4 unknown bytes. The data can be compressed with deflate (RFC 1951); the size in the BBT entry is then the compressed size. Likely block size limit 65,536 bytes. Whether encryption comes before or after compression is not settled; compressed files have not been seen encrypted. |
| XBLOCK, SLBLOCK, subnodes | Same layout as in the 512-byte Unicode format. |