File formats

MBOX vs Maildir And the One Decision Behind Both

Maildir is better while mail is arriving. MBOX is better once it has stopped. That split is not accidental.

6 min read

MBOX puts a whole folder of mail in a single file. Maildir gives every message its own, in a directory of three subfolders. That one decision, made twice in the early nineties, explains every practical difference between them, including which is safe on a shared drive and which takes an hour to back up.

You meet both without choosing either. MBOX arrives from Thunderbird or a Google export. Maildir arrives when somebody hands over what was on a mail server.

MBOX And Maildir, the Same Mail in Two Shapes

Look at a folder of a thousand messages under each and the difference is visible before anything is opened.

MBOX

One file
Inbox
  a single file
  400 MB
  no extension

messages laid end to end
separated by a line
  beginning From

Simple to copy and simple to send. Every write touches the same file.

Maildir

A directory of files
Inbox/
  tmp/
  new/
  cur/
    1709545260.M4�.host:2,S
    1709545301.M8�.host:2,RS
    ... 998 more

One file per message, each named so nothing else will pick that name. No two writes ever meet.

Everything below follows from this. Neither is a better idea in the abstract. They were designed against different problems and both solved the one they aimed at.

The Problem Maildir Was Built to Fix

MBOX came first and it has one structural difficulty. Every message lives in one file, so anything writing to that folder writes to that file.

Two programs doing that at once corrupt it. The usual answer is locking, where one waits while the other finishes. Locking is also the thing that stops working on a shared drive. Over NFS in particular, no locking mechanism has ever worked reliably, which is the single fact that decided the argument for every mail server administrator who met it.

That is the whole reason Maildir exists. Daniel Bernstein wrote it in the mid nineties for qmail, specifically to remove locking from the problem rather than improve it. Delivering a message means creating a new file with a name nothing else will choose, so two concurrent deliveries write to two different places. Nothing has to wait and nothing has to be locked, which is why it works where MBOX does not.

What Maildir's Three Folders Do

Three subdirectories look like fuss. Each one earns its place.

  1. tmp/ Being writtenA message lands here first, while it is still incomplete. Nothing reading the mailbox looks in here
  2. new/ Delivered, unreadOnce the message is complete it is moved here. The move is instant and cannot half happen, which is the safety
  3. cur/ SeenReading a message moves it here, with flags added to the filename. An S means seen, an R means replied
The flags live in the filename rather than inside the message, so marking a thousand messages as read renames a thousand files and rewrites none of them.

A partly delivered message never appears in a mailbox. It sits in tmp until it is whole and then moves. Compare that with MBOX, where a delivery interrupted halfway leaves half a message in the middle of the file and everything after it hard to parse.

Read next What is an MBOX File And Why It is Just a Text File The one file half of this, in full.

Where MBOX And Maildir Each Cost You

The trade runs in opposite directions depending on what you are doing.

TaskMBOXMaildir
Delivering mail continuouslyNeeds lockingNo locking at all
Living on a shared driveUnreliableDesigned for it
Deleting one messageRewrites the whole fileDeletes one file
Copying or backing upOne file, quickThousands of files, slow
Sending to somebodyAttach the fileArchive the directory first
Reading message number 900Read forward to find itOpen that file
Wasted disk spaceVery littleEach file rounds up to a block

Rows one to three favour Maildir and rows four and five favour MBOX. That split is not accidental. Maildir is better while mail is arriving and MBOX is better once it has stopped.

The backup row surprises people running a server. A hundred thousand small files take far longer to copy than one large file of the same total size, because the cost is per file rather than per byte. Archiving the directory before copying it is the usual answer and it is worth doing before anybody times the transfer.

Read next What Deleting Mail Does And What It Leaves Behind What deleting does in each of these. Only one of them actually deletes.

Where You Meet MBOX And Maildir

Neither is something people choose. They arrive attached to whatever produced them.

Where it came fromWhat you get
A Thunderbird profileMBOX, since that is still the default
A Google Takeout exportMBOX, one file per label
Apple MailNeither. Directories of single message files
A Dovecot or qmail serverMaildir, almost always
An older Unix mail spoolMBOX, one file per user
A hosting control panel downloadUsually Maildir, archived first

The Apple Mail row is worth noticing. From a distance it looks like Maildir. A directory, one file per message. It is not. The filenames follow a different scheme and each file carries Apple's own additions. A tool expecting Maildir will make nothing of it.

Deleting Is Where MBOX And Maildir Differ Most

Removing one message shows the structural difference more clearly than anything else.

MBOX      mark it deleted
          rewrite the whole file to remove it
          400 MB written to remove 8 KB

Maildir   delete the file
          done

This is why an MBOX file does not shrink when you delete mail from it. The space is reclaimed only when something rewrites the file. Rewriting a large file is exactly what nobody wants to do often.

Which Format You Have And What to Do With It

  1. Look at the shape. One big extensionless file means MBOX. A directory holding those three subdirectories means Maildir. That settles it without opening anything.
  2. Check the filenames if it is Maildir. A timestamp, a unique part, the hostname, then flags after 2 comma. Those trailing letters are the read and replied states.
  3. Archive a Maildir before moving it. One file transfers in a fraction of the time and arrives intact, which matters more the further it has to go.
  4. Convert on purpose rather than by habit. To MBOX for handing over or archiving. To Maildir for anything that will keep receiving mail.

Neither is a proprietary format and that is worth saying. Both hold ordinary messages in plain text. Anything that can read a single message can read the contents of either one, which is not true of most of the formats mail gets stored in.

Where a Maildir has arrived and the thousands of files are the problem rather than the mail, joining them into one file is the shortest route to something readable. Our MBOX viewer opens the result in a browser tab. The converters handle the route in either direction.

Structure and locking behaviour checked against the referenced articles and RFC 4155 in August 2026.

Questions People Ask

7 questions, answered in full below.

Which one is better?

For a server holding live mail it is Maildir, by a wide margin. For handing a folder of messages to somebody, MBOX, because it is one file rather than thousands. They are good at different jobs rather than one being better.

How do I tell which I have?

By shape alone. One large file with no extension is MBOX. A directory containing three subdirectories called new, cur and tmp is Maildir. Nothing needs opening to answer this.

Why does Maildir not need locking?

Because a new message means a new file. Two programs writing at once are writing to different places, so there is nothing to contend over. MBOX has every message in one file, so a second writer has to wait.

What are the new, cur and tmp folders?

A message is written into tmp first, then moved into new once it is complete. Reading it moves it to cur. The move is the safety, because a half written message never appears anywhere a reader looks.

Can I convert between them?

Yes. It is one of the cleaner conversions. Both hold ordinary messages, so it is a matter of splitting one file into many or joining many into one. The message content survives either way.

Why is my Maildir backup so slow?

Because it is copying thousands of small files rather than one large one. The overhead per file dominates. Archiving the directory into a single file first and copying that is usually far quicker.

Does Thunderbird use either?

MBOX by default and it has offered Maildir as an option for years. The default is what most installations run, which is why a Thunderbird profile usually gives you large extensionless files rather than directories.

Sources

Where the figures and behaviour described above were checked.

  1. Maildir Wikipedia
  2. mbox Wikipedia
  3. The application/mbox Media Type IETF, RFC 4155