SUBMIT A FILE TYPE CONTACT US SUPPORT ABOUT US

What Is an MAB File? The Thunderbird Address Book Written in Mork

An MAB file is a Thunderbird address book written as text in the Mork format, so copy it before you open it. Jump to your question below, or work through it in order.

36 min read Updated October 2026 Checked against sources and tests

What Is an MAB File? A Thunderbird address book written as text

Short answer

MAB files end in .mab, and they are Thunderbird address books. Every one is a text file in the Mork format, so the contacts are written as brackets, numbers and short pieces of text. Current Thunderbird versions use SQLite files instead.

We read 13 public MAB files with four checks, and we damaged one small MAB file in 62 ways. Our script flagged 41 of the 47 harmful edits, and the file command named 37 of those damaged copies a Mork database.

To see the parts, go to the inside part. To check a file, follow the six steps. To judge risk, read the safety part.

MAB files end in .mab, and they are address books from Mozilla Thunderbird. An MAB file is a text file in the Mork format, so every contact is written as brackets, numbers and short pieces of text. New Thunderbird versions store address books in SQLite files instead.

MAB stands for Mozilla address book. FileInfo lists the .mab ending as an address book format from Mozilla. It names three example files, abook.mab for the personal address book, history.mab for collected addresses and impab.mab for an imported address book.

The format inside is Mork. Wikipedia on Mork says Mork is a textual database format that Netscape and Mozilla programs used. It lists .mab, .msf and .dat as endings. It says Thunderbird kept address book data in .mab files and mail folder summaries in .msf files.

PRONOM lists Mork as one format with the endings .mab, .msf and .dat. Its signature is the text // <!-- <mdb:mork:z in the first 20 bytes of the MAB file, and the record dates from 27 February 2014. Our MSF file guide covers the folder summaries.

Why new Thunderbird versions have no MAB file

Thunderbird changed its storage. The notes for Thunderbird 73 beta, dated 31 January 2020, say support for creating Mork based address books was removed. The notes for Thunderbird 78.0, dated 17 July 2020, say address books are now stored as SQLite databases and that existing MAB address books are converted.

So an MAB file shows up in an old profile, a backup, a forensic image or an export from a program that still uses Mork. Our SQLite file guide covers the format that replaced it.

Where our MAB files come from

We wrote one small MAB file ourselves, so it contains no private data. It has 1,867 bytes with three contacts, one mailing list and one edit group. A Python script wrote it in the layout of the public MAB files.

We damaged that file in 62 ways and kept the intact file as a baseline. We also read 13 public MAB files, 12 from the test folders of the Thunderbird source code and 1 from the test folder of the mork-parser package. They add up to 41,351 bytes with 40 contacts and 24 mailing lists.

Four checks read every file. The file command 5.45 names the type, and our own 85 line Python script checks the structure. mork-parser 0.9.0 and mork-converter 2.2 are two public readers of the format. We did not use Thunderbird, and the LibreOffice build on our Linux machine has no Mork driver.

MAB file facts at a glance

Quick facts about MAB files
Property Value
Meaning A Mozilla address book. It lists contacts and mailing lists.
Made by Thunderbird. FileInfo adds SeaMonkey and older Netscape and Mozilla mail programs.
Format Mork, a text database format with no formal standard, says Wikipedia.
Start The line // <!-- <mdb:mork:z v="1.4"/> -->. All 13 public MAB files begin with it.
Standard None. PRONOM lists the format as fmt/612, with the endings .mab, .msf and .dat.
Opens with Thunderbird. FileInfo lists LibreOffice and OpenOffice too, and viewers from SysTools and Freeviewer read it.
Size in our set 1,383 to 6,153 bytes for the public MAB files, with a median of 2,588 bytes.
Replaced by SQLite files like abook.sqlite, from Thunderbird 78.0.
Our tests 13 public MAB files, 1 MAB file damaged in 62 ways, four checks and an 85 line script.

Wrong page? Look at the LDIF page for address book exports, the PAB page for Outlook address books or the DAT page for files with no clear type.

What Is Inside an MAB File? Five parts in a fixed order, from a one line header to the edit group

An MAB file has five parts in a fixed order. One header line comes first. Two dictionaries and a table follow. An edit group can come last. Numbers link the parts.

The figure cuts our 1,867 byte file into its parts. Public Thunderbird files use the same order, but they can repeat the dictionaries, the table and the group.

A bar of 1,867 bytes cut into five numbered parts of one small Thunderbird address book. The header line takes 35 bytes, the column dictionary 987, the value dictionary 239, the table of three cards and one list 516 and the edit group 90.
Our small address book, 1,867 bytes, cut into its five parts. The header is drawn wider than its 35 bytes so its number fits.

The header

The first line is a comment that names the format and its version. All 13 public MAB files start with it, and PRONOM names its first 20 bytes as the signature of a Mork file. A reader that cannot find the line stops or warns.

The first lines of our MAB file and the start of its table, with ... where we cut lines
// <!-- <mdb:mork:z v="1.4"/> -->
< <(a=c)> // (f=iso-8859-1)
(B8=LastModifiedDate)(B9=RecordKey)(BA=AddrCharSet)(BB=LastRecordKey)
  (BC=ns:addrbk:db:table:kind:pab)(BD=ListName)(BE=ListNickName)
  (BF=ListDescription)(C0=ListTotalAddresses)(C1=LowercaseListName)
...
{1:^80 {(k^BC:c)(s=9)} 
  [1:^82(^BB=4)]
  [1
    (^83^82)(^84^83)(^87^81)(^89^84)(^8A^84)(^8C=0)(^8D=0)(^8E=0)
    (^8F=+44 20 7946 0101)(^A7=Northwind Traders)(^A5=Editor)(^B9=1)]
  [2

A second line starts the column dictionary. Its small group <(a=c)> marks the numbers as column numbers. The comment (f=iso-8859-1) names the character set, and all 13 public MAB files have it.

The column dictionary

A dictionary is a list of numbers and their meanings. In the column dictionary every number stands for a column name. Our file has 49 of them, like 83 for FirstName and 87 for DisplayName.

The column dictionary takes 987 of our 1,867 bytes. Every public MAB file repeats it, with between 68 and 86 names. The 13 MAB files use 92 different names, and 67 of them appear in all 13.

The value dictionary

Values that repeat go into a second dictionary. Our file has 16 of them, like 81 for Asha Verma. A cell can point to a value by its number, so the text is written once.

The table

Tables are lists of rows. Our table has six rows. Three are contacts, one is the mailing list, one stores the settings and the last changes a note.

Every row has an id, and a scope after a colon says what kind of row it is. A contact and a mailing list in our MAB file both have the id 1, because the scope separates them. 21 of the 24 mailing lists in the public MAB files share an id with a contact.

The edit group

Mork files change by adding text at the end. An edit group starts with @$${5{@ and ends with @$$}5}@. The change counts only when the end marker is there. Our group changes the note of contact 2.

35 edit groups appear in 8 of the 13 public MAB files, and the other 5 have none. The script counts our table twice, because the edit group names it again.

Escapes and line endings

Two hex digits after a dollar sign stand for one byte, so $E9 is the byte E9. A backslash before a bracket or a dollar sign makes it text. A backslash at the end of a line joins two lines. Thunderbird writes a letter outside ASCII as UTF-8 bytes in this form, like $C3$90 in cardForEmail.mab.

Line endings differ. 9 of the 13 public MAB files use a line feed. 3 use a carriage return and a line feed, and 1 uses a carriage return alone. Only cardForEmail.mab has escapes. It has two.

We read this layout from one small file, 13 public MAB files and the source of two readers. We did not use Thunderbird, so it can read some of these parts in other ways.

How Does an MAB File Store One Contact? Two numbers in a cell, and two dictionaries that give them meaning

An MAB file stores contacts as rows of cells. Cells name a column number and a value or a value number. The two dictionaries change the numbers into field names and text.

The figure follows one cell. The cell (^87^81) says column 87 has value 81. The column dictionary says 87 is DisplayName, and the value dictionary says 81 is Asha Verma. Together they read DisplayName is Asha Verma.

One contact in an MAB file. A cell names a column number and a value number. The column dictionary changes column 87 into DisplayName, the value dictionary changes value 81 into Asha Verma, and the five kinds of brackets in the file are listed beside it.
A cell has two numbers, and the two dictionaries change them into words. Five kinds of brackets build the rest.

Which columns a contact uses

Our file uses 49 column names. A contact has FirstName, LastName, DisplayName, PrimaryEmail, WorkPhone, Company, JobTitle and Notes in our MAB file. A mailing list has ListName and ListTotalAddresses. Settings like PopularityIndex and AllowRemoteContent appear in every contact of our MAB file.

How a mailing list points to contacts

A mailing list stores the row numbers of its members in cells named Address1, Address2 and so on. Our list has ListTotalAddresses 2, with 1 in Address1 and 2 in Address2, so it names contacts 1 and 2.

Our script checks that every number names a contact. Copy 27 makes a list name contact 9, and the script says so. The check part shows the output.

How readers print a contact

mork-parser prints one record for every row number, so it joins contacts and lists that share numbers. For our MAB file it printed Asha and the list Project team as one record. mork-converter keeps the rows apart and names them by number and scope.

mork-parser also removes the spaces from text written straight into a table. It printed NorthwindTraders and +442079460101 for two cells of our MAB file. In the public MAB file cardForEmail.mab it printed Empty Email with its space, because Thunderbird wrote that text into the value dictionary.

What Do 13 Public MAB Files Contain? Contacts, lists, edit groups and four checks

We read 13 public MAB files with four checks. File, mork-parser, mork-converter and our script loaded all 13. Our script flagged none. The files are small and come from test folders, so they show how Thunderbird wrote its address books and not every MAB file you can find.

The figure shows the 13 MAB files and what the four checks did. Twelve come from the test folders of the Thunderbird source code. The 13th is the test file abook.mab of the mork-parser package, which we renamed abook-mp.mab.

13 public MAB files
40 contacts to read
24 mailing lists
41 KB of data to read
Bars show the size of 13 public MAB files and how many cards and lists every file has, and how many files four checks loaded. File, mork-parser, mork-converter and our script loaded all 13, and our script flagged none.
13 public MAB files and four checks. Every check loaded every file.

Where the MAB files come from

The sizes range from 1,383 to 6,153 bytes, with a median of 2,588 and a total of 41,351 bytes. The empty.mab file has no contacts, and listexpansion.mab has 11 contacts and 8 mailing lists.

Every file is a test file, so none belongs to an actual person. The 13 MAB files show the format well, but they do not show how a mail account that is ten years old looks.

What the MAB files show

All 13 MAB files start with the version 1.4 header and the character set comment. 9 use a line feed. 3 use a carriage return and a line feed. 1 uses a carriage return alone.

The files list between 68 and 86 column names, and 67 appear in all 13. Edit groups show up in 8 of the MAB files, 35 in all. listexpansion.mab has 13 of them and abLists1.mab has 7. Only cardForEmail.mab has escapes.

What the four checks did

The file command 5.45 named all 13 MAB files Mork databases. mork-parser 0.9.0 and mork-converter 2.2 loaded all 13. Our script flagged none, so it raised no false alarm on this set.

mork-parser printed 44 records for 40 contacts and 24 mailing lists, because it joins contacts and lists that share row numbers. 21 of the 24 lists share a number with a contact.

mork-converter 2.2 is an old Python 2 program. We converted its source to Python 3 with the 2to3 tool and left its grammar as it was.

The header never changes All 13 MAB files start with version 1.4 and the same character set comment.
Lists share row numbers 21 of the 24 mailing lists share a row number with a contact.
Edit groups are common 35 edit groups appear in 8 of the 13 MAB files.
Line endings differ 9 files use a line feed, 3 use CRLF and 1 uses a carriage return.

What the numbers do not show

We read the MAB files with four checks, and we did not use Thunderbird. The files come from test folders, and none comes from an actual mail account. We cannot say how Thunderbird reads them, only how our checks do.

What Happens When an MAB File Is Damaged? 62 broken copies and 25 that fooled a public reader

We damaged one MAB file in 62 ways and read every copy with four checks. On 25 copies at least one public reader printed other text and no message, and on 6 copies our script stayed quiet. 15 of the 62 edits are harmless.

We changed one thing at a time and sorted the copies into eight groups. They cover the header, the dictionaries, the table, the values, the edit group, the layout, the entire file and random bytes. Copy numbers match the rows of the figure.

A grid of 62 copies of one small address book in eight groups, read by the file command, mork-parser, mork-converter and our own script. Cells show whether a check stopped, warned, printed the text we expected or printed other text.
62 copies of one address book, read by four checks. Cells show what every check did with a copy.

Green means the text we expected, or a flag on a damaged copy. Amber means other text and no message. Blue means a warning, and red means the reader stopped. We compared every reader with its own output for the intact file, because mork-parser drops spaces. Five edits change the right answer on purpose, and we adjusted for them (copies 29, 31, 32, 36 and 38).

The file command reads only the start

The file command named 37 of the 47 damaged copies a Mork database. It flagged 10.

Four are the 20 byte cut (copy 1), the missing first line (copy 3), the byte order mark (copy 4) and the version without quotes (copy 8). The other six are MAB files that are not address books (copies 48 to 50 and 52 to 54).

It named copy 2 (version 1.3) and copy 9 (version 9.9) as Mork databases. It also named copy 51, two address books joined, as a Mork database, because the start looks right.

Two public readers, two sets of rules

mork-parser stopped on 15 damaged copies and warned on 1. It printed other text and no message on 24, and the text we expected on 7. mork-converter stopped on 23 and warned on 9. It printed other text on 13 and the expected text on 2.

Both stopped on only 10 copies. mork-parser stopped alone on 5 and mork-converter alone on 13. Copy 61, with 8 random bytes, stopped both. Copies 2, 3, 8 and 9, which damage the header, passed mork-parser with the expected text, because it skips comment lines and never checks the version.

mork-converter warned on the six damaged header copies. Its message names the Mork version as the problem, and it still printed the contacts. It stopped on both dictionaries that are not closed (copies 10 and 16) and on a missing column scope (copy 12).

On 19 damaged copies neither reader stopped, and on 12 of them both printed other text and no message. A result that looks fine is not proof that the MAB file is fine.

Damage that fools the readers

Copy 57 changed one random byte in the value dictionary. zoe@example.net became zoe@examply.net in both readers, with no message. Our script stayed quiet, because every bracket and number still fits.

Copy 55 changed Zoe to ZoD in the display name. Copy 56 put a control character into the column name ListNickName, so both readers printed an odd column name. Neither printed a message.

Copy 21 renamed the third contact to row 2. Both readers merged Zoe into Ben, so Ben showed Zoe’s last name and email address. 19 values changed and no reader said so.

Copy 42 moved the edit group above the table. The edit was lost without a message, so the note of contact 2 lost its last words. Copy 13 changed DisplayName to Displayname, and both readers printed the new name.

Damage that no reader cares about

15 edits changed nothing a reader needs. Our script flagged none of them. Every reader loaded the copy with words after the header comment (copy 5). Other harmless copies loaded too. They lack the character set comment (copy 15), a company name of 5,000 characters (copy 34) or have one of five layout edits (copies 43 to 47).

mork-converter raised two false alarms. It stopped on the header line written twice (copy 7). On Zoe written as Zo$C3$A9 (copy 32) it printed two characters instead of é, because it reads every escape as one Latin-1 character. mork-parser decodes the pair as UTF-8 and printed é.

We gave mork-parser the MAB files as Latin-1 text. Its command line tool mork2json reads UTF-8 instead, and it printed a replacement character for the raw byte E9 in copy 36.

The UTF-8 form is the one Thunderbird writes, like $C3$90 in cardForEmail.mab. Zoe written as Zo$E9 (copy 31) loaded in both readers.

Our script sees structure and misses meaning

Our script flagged 41 of the 47 damaged copies and none of the 15 harmless copies. It missed copies 13, 21, 42, 55, 56 and 57.

It checks brackets, numbers and markers. It cannot know what a name or an address should say. Four edits look fine to it. They are a changed letter in a value, a column name that is still valid, a row number that is still a number and an edit group above the table.

Every check flagged four files that are not address books. Copies 50, 52, 53 and 54 are a plain text file, a ZIP archive, a SQLite database and a vCard file. All four are named .mab.

What the groups show

Results by group of damaged MAB files
Group What we found
A. Header (1 to 9) The 20 byte cut and the byte order mark stopped mork-parser. Four more copies passed it with the expected text, and mork-converter warned on six. Copy 7 is harmless and stopped mork-converter.
B. Dictionaries (10 to 17) Four damaged dictionaries stopped mork-converter, and mork-parser stopped on the value dictionary that is not closed. The renamed column (copy 13) fooled all four checks.
C. Table and rows (18 to 27) Both readers stopped on a table that is not closed and on a table id of G. A row renamed to an existing number (copy 21) merged two contacts and fooled all four checks.
D. Values and escapes (28 to 36) An unescaped bracket stopped mork-converter. Six of the nine edits are harmless, and the one that fooled mork-converter was the UTF-8 escape.
E. Edit groups (37 to 42) A group without its end marker or its start marker stopped mork-converter. mork-parser stopped on the missing start marker and warned on the missing end marker. The edit group above the table (copy 42) lost an edit with no message.
F. Layout (43 to 47) Line feeds, carriage returns, tabs, a missing last line break and blank lines changed nothing. Every reader printed the expected text.
G. Entire file (48 to 54) The file command flagged six of the seven files, and our script flagged all seven. Two address books joined (copy 51) passed the file command, and mork-parser printed the expected text.
H. Random bytes (55 to 62) Copies 55 to 57 changed one byte and fooled all four checks. Copies 58 to 62 changed four or eight bytes, and our script flagged all five.

Read the grid with care. Green cells mean the text we expected. We did not use Thunderbird, and we compared text and not every byte. Every test changed one thing in one small file.

What Does Our Expert Say About MAB Files? A note from Neeraj Singh on reading a contact list with care

Copy an MAB file before you read it, and keep the original. An MAB file is a contact list that few tools read well. Our test shows 25 damaged copies where at least one public reader printed other text and no message.

Neeraj Singh

Expert insight

An MAB file is your contact list in a format few tools read well. In our test both public readers printed other text and no message on 12 damaged copies, so a result that looks fine proves little. Copy the MAB file first, read it with two tools and keep the original.

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

Why a contact list needs care

People think an address book is easy to read, because it only contains names and numbers. An MAB file is a database written as text. One wrong byte can rename a contact, change an email address or drop an edit.

The readers add a second risk. Two public readers printed other text and no message on 12 damaged copies. A report from one reader can show wrong text. Read the MAB file with two readers, and add a script that checks the structure.

Keep the original. Copy the MAB file before you edit it, and write down its SHA256 hash. The hash shows which file you received and whether a later copy differs.

How Do You Open an MAB File? Thunderbird, a text editor, a free parser or a viewer

Old Thunderbird versions open an MAB file as their address book, and new ones read it through the import tool. To read one without Thunderbird, use a text editor, a free parser or a viewer from SysTools or Freeviewer. Copy the MAB file before you open it.

We read MAB files on Linux with free tools. We did not use Thunderbird, SysTools MAB Viewer or Freeviewer MAB Viewer.

In Thunderbird

Thunderbird kept its address books in the profile folder. Mozilla’s profile article gives %APPDATA%\Thunderbird\Profiles\ as the place on Windows, and ~/Library/Thunderbird/Profiles/ on a Mac. The Help menu has a Troubleshooting Information page with a button that opens the folder.

Thunderbird 78.0 converted old MAB address books to SQLite, so a new profile has no MAB file.

A newer Thunderbird has an import page for address book files. The Bugzilla entry lists importers for .mab, LDIF, vCard, CSV and TSV files. The source commit for the .mab importer is dated 25 February 2022 for version 99.0a1. Thunderbird 102, released on 29 June 2022, is the first release after it.

The Thunderbird 102 release notes we read do not mention the importer, and we did not use Thunderbird. Check that your version has it before you rely on it. The notes for Thunderbird 78.0 cover the conversion.

In a text editor

An MAB file is text, so Notepad, TextEdit and any code editor open it. Work on copies and do not save. You see the header, the dictionaries and the rows of cells. The values are readable, but the field names are numbers, so look every number up in the column dictionary.

With a free parser

Two public programs read the Mork format. mork-parser is a Node package with the MIT license, and its mork2json command writes JSON. mork-converter is a Python 2 program with the GPL 2 license that writes XML or CSV. We called both from small scripts, so the commands below are the ones their documentation gives.

Five commands that read an MAB file and change nothing
sha256sum address-book.mab
head -n 2 address-book.mab
file address-book.mab
mork2json address-book.mab address-book.json
python3 mab_peek.py address-book.mab
The mork-converter command for CSV, on Python 2
mork --csv --outname=csvout address-book.mab

The two parsers print the same contact in different shapes. mork-parser printed contact 2 of our MAB file as one record. mork-converter printed it under the row number and the scope.

Contact 2 of our MAB file in mork-parser
{
 "FirstName": "Ben",
 "LastName": "Okafor",
 "DisplayName": "Ben Okafor",
 "PrimaryEmail": "ben.okafor@example.org",
 "LowercasePrimaryEmail": "ben.okafor@example.org",
 "PreferMailFormat": "0",
 "PopularityIndex": "0",
 "AllowRemoteContent": "0",
 "HomePhone": "+12025550143",
 "Company": "Fabrikam",
 "Notes": "Metatthespringfair,callinMay",
 "RecordKey": "2"
}
Contact 2 of our MAB file in mork-converter
{
 "AllowRemoteContent": "0",
 "Company": "Fabrikam",
 "DisplayName": "Ben Okafor",
 "FirstName": "Ben",
 "HomePhone": "+1 202 555 0143",
 "LastName": "Okafor",
 "LowercasePrimaryEmail": "ben.okafor@example.org",
 "Notes": "Met at the spring fair, call in May",
 "PopularityIndex": "0",
 "PreferMailFormat": "0",
 "PrimaryEmail": "ben.okafor@example.org",
 "RecordKey": "2"
}

Look at the Notes and HomePhone lines. mork-parser removed the spaces from Met at the spring fair, call in May and from the phone number, because we wrote both straight into the table. mork-converter kept them.

With a viewer

Two vendors list viewers for MAB files on Windows. We tested neither, and both pages come from the vendors.

SysTools MAB Viewer

Read Thunderbird address books on Windows

Viewing listed as free

Freeviewer MAB Viewer

Preview MAB contacts on Windows

Free version listed

The SysTools page says its viewer opens abook.mab, history.mab and impab.mab, and it reads SQLite address books too. It finds address books in Thunderbird profiles, and it does not need Thunderbird except for that search. The page says the free version views contacts and caps conversion at 15 contacts per file.

The Freeviewer page lists the same three file names. It lists CSV, PST and vCard as export formats. The free version covers the first 15 contacts. Its two lists of Windows versions disagree, so check the system requirements on the page.

The FileInfo page says LibreOffice and OpenOffice import MAB files through their address data source wizard. The LibreOffice build on our Linux machine has no Mork driver, so we could not test that route.

On a Mac or on Linux

A text editor works on any system. mork-parser needs Node, and the original mork-converter needs Python 2, which many systems no longer install. The two vendor viewers are Windows programs. Our own script needs Python 3 and nothing else.

How the checks did on our 47 damaged copies

How every check did on our 47 damaged MAB files
Check Result
file 5.45 Named 37 copies Mork databases and flagged 10. It looks at the start of the MAB file only.
mork-parser 0.9.0 Stopped on 15 copies and warned on 1. It printed other text and no message on 24.
mork-converter 2.2 Stopped on 23 copies and warned on 9. It printed other text and no message on 13, and it raised 2 false alarms on the 15 harmless copies.
Our script Flagged 41 of the 47 damaged copies and none of the 15 harmless ones.

How Do You Check an MAB File? Six steps, and an 85 line script

Check an MAB file in six steps. Hash it, read its first line, name its type and use our script that checks the structure. Then read the contacts with two readers and compare them. No check proves that every contact is right.

The six steps

  1. Copy the MAB file, write down its SHA256 hash and work on the copy.
  2. Read the first line with head -n 1 file.mab. A Mork file starts with // <!-- <mdb:mork:z v="1.4"/> -->.
  3. Name the type with file file.mab. You want a line that starts with Mozilla Mork database.
  4. Use the script below. It reads every part and names the faults it can see.
  5. Read the contacts with two parsers, or with one parser and one viewer. Compare names and email addresses.
  6. Stop if the script names a fault, the readers disagree or the MAB file did not come from Thunderbird. Get the original from its source.

The 85 line script that reads MAB files

The Python script below does steps 2 to 4. It reads the header, both dictionaries, the table and the edit groups. It names every fault it finds. It changes no file and starts nothing.

It checks the header, the brackets, the aliases and the scopes. It reads every cell and checks that its column and value numbers exist, that a mailing list names a contact and that every dollar escape has two hex digits. It flags a group that is not closed or that was aborted.

mab_peek.py
#!/usr/bin/env python3
"""mab_peek.py: check the structure of a Mork (.mab) file. It reads the file and changes nothing."""
import re, sys

MAGIC = b'// <!-- <mdb:mork:z v="1.4"/> -->'
TOK = re.compile(r'''(?P<com>//[^\r\n]*)|(?P<gs>@\$\$\{(?P<gsi>[0-9A-Fa-f]+)\{@)|(?P<ge>@\$\$\}(?P<ab>~abort~)?(?P<gei>[0-9A-Fa-f]*)\}@)
  |(?P<cell>\((?:[^)\\]|\\.)*\))|(?P<open>[<{\[])|(?P<close>[>}\]])|(?P<ws>\s+)|(?P<id>[-+!]?[0-9A-Fa-f]+(?::\^?[0-9A-Fa-f]+|:[a-z])?)|(?P<bad>.)''', re.X | re.S)
ALIAS = re.compile(r'\(\s*([0-9A-Fa-f]+)\s*=(.*)\)\Z', re.S)
CELL = re.compile(r'\(\s*\^([0-9A-Fa-f]+)(?::[a-z])?\s*(?:=(.*)|\^([0-9A-Fa-f]+))\)\Z', re.S)


def peek(path):
    data = open(path, 'rb').read()
    info = dict(dicts=0, tables=0, rows=0, cells=0, groups=0)
    if not data.startswith(MAGIC):
        return dict(errors=['the file does not start with the Mork 1.4 header'], info=info)
    errs, stack, groups = [], [], []
    cols, atoms, dscope, meta, rowid, cards, lists = {}, {}, 'a', False, None, set(), []
    if b'\0' in data:
        errs.append('NUL byte at offset %d' % data.index(b'\0'))
    text, pos = data.decode('latin-1'), 0
    while pos < len(text):
        m = TOK.match(text, pos); pos = m.end(); k = m.lastgroup
        k = 'gs' if m.group('gs') else 'ge' if m.group('ge') else k
        top = stack[-1] if stack else ''
        if k == 'bad':
            errs.append('unexpected %r at offset %d' % (m.group(), m.start()))
        elif k == 'open':
            c = m.group()
            info['dicts'] += c == '<' and not stack.count('<'); info['tables'] += c == '{' and not stack.count('{'); info['rows'] += c == '['
            if c == '<' and top == '<': meta = True
            if c == '<' and not stack: dscope = 'a'
            stack.append(c); rowid = None if c == '[' else rowid
        elif k == 'close':
            want = {'>': '<', '}': '{', ']': '['}[m.group()]
            if top != want:
                errs.append('%s at offset %d does not match %s' % (m.group(), m.start(), top or 'nothing')); continue
            if stack.pop() == '<': meta = False
        elif k == 'id' and top in '{[':
            nm, _, sc = m.group().lstrip('-+!').partition(':')
            if sc.startswith('^') and sc[1:].upper() not in cols:
                errs.append('scope %s at offset %d is not defined' % (sc, m.start()))
            if top == '[' and rowid is None:
                rowid = nm.upper()
                cards.add((sc, rowid))
        elif k == 'cell':
            v = m.group(); info['cells'] += 1
            if top == '<':
                a = ALIAS.match(v)
                if meta:
                    dscope = 'c' if v == '(a=c)' else dscope
                elif a:
                    d = cols if dscope == 'c' else atoms
                    if a.group(1).upper() in d: errs.append('alias %s is defined twice' % a.group(1))
                    d[a.group(1).upper()] = a.group(2)
                else: errs.append('bad alias %s at offset %d' % (v[:12], m.start()))
            elif top == '[':
                c = CELL.match(v)
                if not c: errs.append('bad cell %s at offset %d' % (v[:12], m.start()))
                else:
                    if c.group(1).upper() not in cols: errs.append('column %s is not defined' % c.group(1))
                    if c.group(3) and c.group(3).upper() not in atoms: errs.append('value %s is not defined' % c.group(3))
                    if re.match(r'Address\d+\Z', cols.get(c.group(1).upper(), '')) and c.group(2): lists.append(c.group(2).upper())
            if re.search(r'(?<!\\)\$(?![0-9A-Fa-f]{2})', v): errs.append('bad $ escape in the cell at offset %d' % m.start())
        elif k == 'gs':
            groups.append(m.group('gsi').upper()); info['groups'] += 1
        elif k == 'ge':
            gi = m.group('gei').upper()
            if not groups: errs.append('group end %s has no start' % gi)
            else:
                g = groups.pop()
                if m.group('ab'): errs.append('group %s was aborted' % g)
                elif g != gi: errs.append('group %s ends as %s' % (g, gi))
    errs += ['the file has no table'] * (not info['tables'])
    errs += ['%s is never closed' % c for c in stack] + ['group %s never ends' % g for g in groups]
    ids = {r for s, r in cards if not s}
    errs += ['a list names row %s, which is not in the book' % a for a in lists if a not in ids]
    return dict(errors=errs, info=info)


if __name__ == '__main__':
    for p in sys.argv[1:]:
        r = peek(p); i = r['info']
        print('%s: %d dict, %d table, %d rows, %d cells, %d groups' % (p, i['dicts'], i['tables'], i['rows'], i['cells'], i['groups']))
        print('  ' + '\n  '.join(r['errors'] or ['no problem found']))

On our intact MAB file it finds 2 dictionaries, 2 table blocks, 6 rows, 114 cells and 1 group. It reports no problem. It counts the table twice, because the edit group names it again. It read all 13 public MAB files in under 3 milliseconds per file and flagged none.

The script on our intact MAB file
python3 mab_peek.py address-book.mab
address-book.mab: 2 dict, 2 table, 6 rows, 114 cells, 1 groups
  no problem found
The script on four damaged copies
python3 mab_peek.py copy-2.mab
copy-2.mab: 0 dict, 0 table, 0 rows, 0 cells, 0 groups
  the file does not start with the Mork 1.4 header

python3 mab_peek.py copy-37.mab
copy-37.mab: 2 dict, 2 table, 6 rows, 114 cells, 1 groups
  group 5 never ends

python3 mab_peek.py copy-27.mab
copy-27.mab: 2 dict, 2 table, 6 rows, 114 cells, 1 groups
  a list names row 9, which is not in the book

python3 mab_peek.py copy-30.mab
copy-30.mab: 2 dict, 2 table, 6 rows, 114 cells, 1 groups
  bad $ escape in the cell at offset 1403

Copy 10 shows how one fault spreads. We left the column dictionary open, so the script read the value dictionary as part of it and named every value as undefined. It printed 20 lines, and the box shows the first six.

The script on a copy with an open dictionary
python3 mab_peek.py copy-10.mab
copy-10.mab: 1 dict, 2 table, 6 rows, 114 cells, 1 groups
  value 82 is not defined
  value 83 is not defined
  value 81 is not defined
  value 84 is not defined
  value 84 is not defined
  ... and 14 more lines
The script on a plain text file with the .mab ending
python3 mab_peek.py copy-50.mab
copy-50.mab: 0 dict, 0 table, 0 rows, 0 cells, 0 groups
  the file does not start with the Mork 1.4 header

What the script cannot see

The script reads structure and not meaning. It printed no problem for copy 57, where zoe@example.net became zoe@examply.net. It also stayed quiet on copy 21, where two contacts share a row number. It stayed quiet on copy 42 too, where the edit group comes before the table.

The script on a copy with one changed letter
python3 mab_peek.py copy-57.mab
copy-57.mab: 2 dict, 2 table, 6 rows, 114 cells, 1 groups
  no problem found

The script never checks that a name or an address is right. We wrote it from our 62 copies and 13 public MAB files, so it knows the faults we tested and no others. A file that passes can still read in other ways in Thunderbird, which we did not use.

Want the causes of an error? Go to the causes.

Is an MAB File Safe to Open and Share? Reading starts nothing, and sharing shows your contacts

An MAB file is safe to read and not safe to share. It is a data file, and it starts nothing by itself. It contains names, email addresses and phone numbers, so treat every MAB file as private data.

Reading an MAB file with a text editor, a script or a parser starts nothing. The risk is the data. We scanned no file for malware, and the 13 public MAB files are test files with made up contacts.

What is inside an MAB file

Names and email addresses Every contact in our MAB file has a first name, a last name, a display name and an email address.
Phone numbers Our dictionary has work, home, fax, pager and cell phone columns.
Addresses It also has home and work address columns. The home columns add city, state, zip code and country.
Notes A notes column can contain any text that a person typed.

Old values can stay in the MAB file

Mork files change by adding an edit at the end. In our MAB file the old note reads Met at the spring fair. The new note reads Met at the spring fair, call in May. Both are readable text. We do not know when Thunderbird rewrites a file, so treat an MAB file as a record of older data too.

Before you share an MAB file

  1. Open your copy in a text editor and look at what it contains.
  2. Ask whether the other side needs every contact. Send fewer when you can.
  3. Export only the contacts you need from Thunderbird. Its source code lists CSV, tab, vCard and LDIF as export formats.
  4. Send the MAB file over a channel you trust, and send its hash by another route.
  5. Delete your extra copies when the other side confirms the MAB file.

Use copies. Work on copies of MAB files, and write down their SHA256 hashes. Keep the original read only, so no tool can change it.

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

MAB files fail for eight reasons. The file can be another kind or cut short. The header, a dictionary, the table, a value or an edit group can be wrong. The reader or the Thunderbird version can also be the problem.

The table lists what we saw in our 62 copies and what the readers said. We tested three programs and a script on Linux. Read every fix as a first step and not the final answer.

Eight causes of MAB files that will not work
Cause Details and fix
You have a different kind of file The .mab ending can hide plain text (copy 50), a ZIP archive (copy 52), a SQLite database (copy 53) or a vCard file (copy 54). All four checks flagged those four. Fix: Read the first line. Mork files start with // <!-- <mdb:mork:z. SQLite files start with SQLite format 3.
The file is cut short or empty A cut to 20 bytes (copy 1) stopped mork-parser, and mork-converter warned. An empty file (copy 48) and 600 zero bytes (copy 49) were flagged by the file command and our script. Fix: Compare the size and the hash with the source. The smallest public MAB file has 1,383 bytes.
The header is damaged Byte order marks before the header (copy 4) stopped mork-parser. A removed first line (copy 3) and a changed version (copies 2 and 9) still loaded in mork-parser, and mork-converter warned. Fix: Copy the MAB file again, and compare the first line with a good file.
A dictionary is broken An open column dictionary (copy 10), a missing alias bracket (copy 11) and a removed column scope (copy 12) stopped mork-converter. mork-parser printed other text. Fix: Read the MAB file with our script, which names the numbers it cannot find.
The table or a row is broken A table that is not closed (copy 18), a table id of G (copy 20) and a cut inside a row (copy 26) stopped both parsers. An open row (copy 19) stopped mork-converter, and mork-parser printed other text. Fix: Look for the bracket that the script names.
A value has a bad escape An unescaped bracket (copy 28) stopped mork-converter. A bad dollar escape (copy 30) and a NUL byte (copy 35) gave other text in both parsers. Fix: Find the value that the script names and compare it with a good copy.
The edit group is incomplete A group without its end marker (copy 37) stopped mork-converter, and mork-parser warned. A group that was aborted (copy 38) or ended with another id (copy 39) stopped mork-parser. Fix: Ask who wrote the MAB file, because an incomplete edit group means a lost edit.
The reader or the Thunderbird version is the problem mork-converter stopped on a harmless header line that appears twice (copy 7). mork-parser drops spaces from text written into the table. Thunderbird 78.0 and later has no MAB file, because it converts address books to SQLite. Fix: Try a second reader, and look for abook.sqlite in the profile folder.

Fix an MAB file in seven steps

  1. Copy the MAB file, write down its SHA256 hash and work on the copy.
  2. Read the first line and name the type. A Mork file starts with // <!-- <mdb:mork:z v="1.4"/> -->.
  3. Compare the size with the source. The smallest public MAB file has 1,383 bytes, so a file of a few dozen bytes is cut.
  4. Read the MAB file with the check script, and note every fault it names.
  5. Read the MAB file with a second parser. When two readers print different text, trust neither.
  6. Look in the profile folder for abook.sqlite. A new Thunderbird stores its address book there and not in an MAB file.
  7. If the MAB file is damaged, copy it again from its source or from a backup. If you cannot, export the contacts again from the program that wrote them.

We did not test repairs on files from other people. An MAB file that passes our script can still fail in Thunderbird, and a file that fails in the script can still load there. Only Thunderbird knows what it accepts.

What to send when you ask for help

If a forum or a support team asks about your MAB file, send these lines. They show what the MAB file is and where the readers stopped, and they save rounds of questions. Remove names and email addresses first.

A message that gets an answer
Subject: MAB file will not open
File: name, size in bytes and SHA256 hash
First line: the output of head -n 1 file.mab
Type: the output of file file.mab
Script: the output of mab_peek.py
Readers: the output of mork2json or another parser
Thunderbird: the version and the operating system
History: where the MAB file came from and what changed

Not an error, but a question about similar files? Go to the versus part.

How Do You Convert an MAB File? To JSON, XML, CSV, vCard or LDIF

You can convert an MAB file to JSON, XML or CSV with a free parser. Thunderbird can export address books to CSV, tab, vCard and LDIF. A converter reads the MAB file and writes a new one, and the original stays unchanged. Renaming an MAB file does not convert it.

This part reports what we tested on Linux. We did not use Thunderbird, so every claim about its import and export comes from its source code and release notes.

To JSON, XML or CSV

mork-parser writes JSON with its mork2json command. mork-converter writes XML or CSV, and its documentation lists the commands. We read our MAB file with both parsers from scripts and compared the contacts with what we wrote. Names, email addresses and phone numbers matched, apart from the spaces that mork-parser removes from text written into the table.

To vCard, LDIF or CSV through Thunderbird

Thunderbird’s source code lists CSV, tab, vCard and LDIF as export formats for address books. An MAB file has to be imported first, so this route needs a Thunderbird version with the .mab importer. The Mozilla wiki page on the address book recommends LDIF for moving data out of Thunderbird. Our guide to LDIF files covers the export format.

What you cannot convert

Renaming an MAB file to .sqlite does not make an address book. SQLite files start with different bytes, and copy 53 shows that all four checks flag a SQLite file named .mab. An MSF file is a mail index and not an address book, so converting it gives no contacts.

Conversions and how much we know
Task What we know
MAB to JSON Tested with mork-parser and mork-converter on our MAB file. The contacts matched, and mork-parser dropped spaces in table text.
MAB to CSV or XML Not tested. The mork-converter documentation lists the command and the options.
MAB to vCard, LDIF or CSV Not tested. Thunderbird’s source lists these export formats. The MAB file needs an import first.
MAB to SQLite Not tested. The Thunderbird 78.0 notes say the program converts old address books itself.
Viewer export Not tested. SysTools and Freeviewer list conversion and export, and both cap the free version at 15 contacts.

How Does an MAB File Differ From SQLite, MSF and LDIF Files? An address book, its successor, a mail index and an export

An MAB file is a Mork address book. A SQLite file replaced it in Thunderbird. LDIF, vCard and CSV files store exports. An MSF file uses the same Mork format for a mail index, and a PAB file is an Outlook address book.

People mix these types up because all of them store contacts or mail data for an address book or a mail program. The table sorts them by what they store and which program writes them.

MAB files next to similar files
Type What it is
MAB A Thunderbird address book in the Mork text format. Thunderbird 78.0 stopped using it for new profiles.
SQLite address book A binary database. Thunderbird 78.0 stores address books this way, and our guide to SQLite databases covers it.
MSF Mork too, but a mail folder summary and not an address book. Our guide to MSF files covers it.
LDIF Text export format. The Mozilla wiki recommends it for moving data out of Thunderbird, and it says the importers handle it fairly well.
vCard and CSV Export formats that Thunderbird writes. A vCard file named .mab was flagged by all four checks (copy 54).
PAB The personal address book of older Outlook versions, and not a Mork file. Our guide to PAB files covers it.

Other mail files also look alike. An MBOX file stores full messages, and our MBOX file guide explains it. An EML file stores one message, and our guide to EML files covers that format.

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

An MAB file is a Mork text file with a header, two dictionaries, a table and edit groups. Numbers link the parts, and brackets mark them. The facts below come from Mozilla, Wikipedia, PRONOM and our checks of 13 public MAB files and 62 damaged copies.

Facts about the MAB file format
Part What we checked
Name Mork, a textual database format by David McCusker, with no formal standard. (Wikipedia)
Endings .mab for address books, .msf for mail folder summaries and .dat for other data. (Wikipedia, PRONOM)
Origin McCusker’s primer is a Netscape newsgroup post of 16 March 1999. (Mozilla archive)
Signature The text // <!-- <mdb:mork:z in the first 20 bytes. PRONOM added it on 27 February 2014 as fmt/612. (PRONOM)
Parts Header, column dictionary, value dictionary, table and edit group. (Our file, 13 public MAB files)
Cells Round brackets with a column and a value, written as text or as hex ids like (^8^9). (Mozilla primer, our MAB file)
Rows and tables Square brackets for rows and curly brackets for tables. A row starts with its id. (Mozilla primer, our MAB file)
Dictionaries Angle brackets with aliases like (80=cards). Numbers 0 to 7F stand for the ASCII values of one byte strings. (Mozilla primer)
Escapes Closing brackets and backslashes need a backslash. Dollar signs start bytes written as two hex digits. (Mozilla primer, copies 28 and 30)
Edit groups A group starts with @$${5{@ and counts when @$$}5}@ closes it. (Our file, mork-converter source)
Character set The comment (f=iso-8859-1) is in all 13 public MAB files. Thunderbird writes other letters as UTF-8 bytes in dollar form. (Our files)
Line endings 9 of the 13 public MAB files use a line feed, 3 use CRLF and 1 uses a carriage return. (Our files)
Thunderbird 73 The beta of 31 January 2020 removed support for creating Mork address books. (Thunderbird release notes)
Thunderbird 78 Release 78.0 of 17 July 2020 stores address books as SQLite and converts old MAB files. (Thunderbird release notes)
Import The source has a .mab importer, committed on 25 February 2022 for version 99.0a1. (Bug 1720042, Thunderbird source)
Our counts 13 public MAB files, 62 copies of one MAB file, four checks and an 85 line script.

About the values we list

Rules about the format come from McCusker’s Mork primer, from the source of two readers and from our tests. The mork-converter author calls the MDN page on Mork structure questionable, so we did not use it. Counts come from our own files.

SysTools says SQLite replaced MAB in Thunderbird 78.0. The release notes we read name 73 beta as the version that stopped creating Mork address books and 78.0 as the version that converts them, so we use the notes.

What we left out

We damaged one small MAB file that has two dictionaries, three contacts, one mailing list and one edit group. Files with photos, custom fields or many edit groups can react in other ways. We did not damage an MSF file or a history.mab file.

We did not use Thunderbird and tested no Windows program. We compared text and not every byte. We used three readers on Linux, so Thunderbird and the vendor viewers can behave in other ways.

The public MAB files come from test folders and not from actual mail accounts. We left out the Mork features that address books do not use, like meta tables and row moves.

Sources checked

For the format, see Wikipedia’s Mork article, the PRONOM record and the Mozilla wiki page on the address book. For the end of Mork address books, see the notes for Thunderbird 73 beta and Thunderbird 78.0.

For the MAB file ending, see the FileInfo page on MAB files. For the importer, see Bug 1720042. Every count came from files and scripts in our research folder.

Frequently Asked Questions About MAB Files

What is an MAB file?

An MAB file is a Thunderbird address book written in the Mork format. It is a text file with a header, two dictionaries and a table of contacts and mailing lists. The ending stands for Mozilla address book.

How do I open an MAB file?

Open it in a text editor to read it. To see the contacts as a list, use a parser like mork-parser or a viewer from SysTools or Freeviewer. New Thunderbird versions import address book files through the import page, but we did not test that.

Why does my new Thunderbird have no MAB file?

Thunderbird 78.0 stores address books as SQLite databases and converts old MAB files. A new profile has abook.sqlite and not abook.mab. The 73 beta had already stopped creating Mork address books.

Is an MAB file a virus?

No. An MAB file is a data file, and it starts nothing by itself. It does contain names, email addresses and phone numbers, so share it with care. We scanned no file for malware.

Why does my MAB file not work?

Eight causes cover what we found. The file can be another kind or cut short. The header, a dictionary, the table, a value or an edit group can be wrong. The reader or the Thunderbird version can be the problem. Try a second reader before you call the MAB file bad.

How do I check an MAB file?

Hash it, read its first line and name its type with the file command. Then use our 85 line script and read the contacts with two parsers. Our script flagged 41 of 47 damaged copies and none of the 15 harmless ones.

Can I convert an MAB file to CSV, vCard or LDIF?

Yes, but not by renaming it. mork-converter writes XML or CSV, and mork-parser writes JSON. Thunderbird’s source lists CSV, tab, vCard and LDIF as export formats. The MAB file needs an import first.

What is the difference between an MAB file and an MSF file?

Both use the Mork format. An MAB file stores an address book, and an MSF file stores a summary of a mail folder. Both have their own columns and their own job.

Can I edit an MAB file in a text editor?

You can read it, but do not edit it by hand. One wrong byte can rename a contact, merge two contacts or drop an edit. Most readers print no message. Export the contacts again from the program that wrote the MAB file, and keep the original.

What does the first line of an MAB file say?

It is a comment that names the format and its version, like version 1.4. All 13 public MAB files start with the same line. PRONOM names its first 20 bytes as the signature of a Mork file.

Does an MAB file contain mailing lists?

Yes. A list is a row that names its members by their row numbers. Our file has one list with two members, and the 13 public MAB files have 24 lists. Our script checks that every number names a contact.

Can LibreOffice open an MAB file?

FileInfo says LibreOffice and OpenOffice import MAB files through the address data source wizard. The LibreOffice build on our Linux machine has no Mork driver, so we could not test it. Check your version before you rely on it.

Still Stuck With an MAB File? Two routes out, and where to look next

Your MAB file won’t work

Read the first line and follow the seven steps. The cause table lists what to try in order.

You do not know what it contains

Read the contact part, and then start our script.

Is it a mail index? An MSF file is a mail folder summary in the same format. Our page on MSF files covers it, and the versus part shows how the two differ.

Is it an exported address book? LDIF files store exports. Our page on LDIF files covers the format.

Is it a SQLite database? New Thunderbird versions use one. Our page on SQLite files covers it.

Is the data unknown? Our page on DAT files covers files with no clear type, and the file extension resource library lists many more.

Is your type missing? Send it on the submit a file type page.