Skip to content
Mbox Viewer

Compacting

X-Mozilla-Status

The operation that actually removes deleted messages from an mbox file. Until it runs, a deleted message is only marked as deleted — it is still in the file, and still readable.

Thunderbird and other mbox-based clients do not rewrite a whole mailbox every time you delete a message; that would be far too slow. Instead they set a flag in the message's headers — X-Mozilla-Status and X-Mozilla-Status2 — marking it deleted, and move on. The bytes stay exactly where they were. Compacting is the separate step that rewrites the file without the flagged messages and reclaims the space.

This explains a common surprise: a folder that shows four thousand messages occupying nine gigabytes on disk. The difference is deleted mail that has never been compacted away. It also explains why a mailbox copied out of a profile can show messages the owner believes were deleted long ago — an external reader has no reason to honour a flag Thunderbird invented.

Before splitting, copying or handing over a mailbox, it is worth deciding deliberately which behaviour you want: compact first if those messages should not travel with the file, or skip it knowingly if they are part of what you mean to preserve. Either way, count the messages afterwards so you know what you actually have.

Related terms

Read your MBOX files on Mac and Windows