MBOX

What is an MBOX file?

A whole mailbox in one file. What a Gmail or Thunderbird export gives you.

What MBOX is

MBOX is a plain-text format you can open in any editor. It is used for email and archiving.

The extension is .mbox, and the full name is Mailbox Archive. Both matter less than what the file can hold, which is what the rest of this page is about.

Where MBOX came from

It dates from 1975. The specification is RFC 4155.

A format that has been readable for that long is a format worth trusting with something you want back in ten years.

The specification is public

It is published in full, so anyone can implement it from the document rather than by inspection, which is why it turns up in so many programs and why files written twenty years ago still open. A published specification is not the same thing as a royalty-free one: where a format wraps a codec, the patent licensing is a separate question the standard does not settle.

It can hold several pages in one file

MBOX is not limited to one page, which matters when converting to something that is: one conversion produces one file holding a single page — the first one, unless the page is something the converter lets you pick.

What opens MBOX

Mozilla Thunderbird and Apple Mail read it, and so do most programs of the same kind.

If a file will not open, the format is rarely the problem — it is more often that the program predates it. Converting to something older is the reliable way past that, and it is what the rest of this site is for.

Opening it in a browser

No browser reads it.

That is the single most common reason to convert it: not that the format is bad, but that the place you want to show the file cannot read it.

It is a delivery format

MBOX is meant to be handed over rather than worked in. Editing one is possible and rarely pleasant; the sane approach is to change the source and export again.

You probably got this from Google Takeout

MBOX is what a mailbox export gives you, and by far the most common route to one is Google Takeout — the service that hands over a copy of your Gmail. Thunderbird exports the same way, Apple Mail can, and most archiving and migration tools produce it because it is the one mailbox format everything agrees on.

What arrives is one file per label or folder, and it can be very large. A decade of email with attachments is routinely several gigabytes, sometimes tens. That size is the first surprise, and it is not a mistake — the file contains every message and every attachment, uncompressed.

The design is a text file with everything glued together

An MBOX is every message in the mailbox written out one after another into a single plain-text file. Each message begins with a line starting "From " — no colon, which is what distinguishes it from the From: header — and runs until the next such line begins.

That is the entire structure. No index, no table of contents, no per-message boundary beyond a line of text that happens to start in the right way. It is a design from 1975 and it has exactly the properties you would expect: gloriously simple, readable by anything, and completely unsuited to finding one message among forty thousand.

Why a message sometimes gets cut in half

Because the separator is a line of ordinary text, a message whose own body contains a line beginning "From " at the start looks like the start of the next message. Mail software escapes those lines when writing the file, usually by inserting a greater-than sign, and different implementations have escaped them differently for fifty years.

This is the source of the format’s reputation for corruption. A mailbox written by one program and read by another can show a message truncated, or two messages merged, or a stray angle bracket at the start of a line that was fine in the original. The file is not damaged; two implementations disagreed about a convention that was never precisely specified.

Opening one without importing it into anything

Thunderbird is the standard answer: create a local folder, drop the MBOX in the profile directory or use an import add-on, and the messages appear as a normal mailbox you can search and read. For a one-off look at a large export this is worth the twenty minutes it takes.

A text editor will open it too, and for a small file that is genuinely the fastest way to answer "is the message I need actually in here". For a multi-gigabyte file, most editors will refuse or take the machine down with them — that is a limit of the editor rather than the format.

What no browser and no operating system will do is show it to you by double-clicking. There is no built-in handler on Windows or macOS, which is why the file so often sits in the Downloads folder for a year.

Splitting it into individual messages

This is what most people actually want. An MBOX is a backup; individual EML files are things you can read, forward, attach to a filing or hand to a lawyer. Splitting turns one opaque object into a folder you can search with the tools you already have.

It is also the right first step before any conversion. Converting an entire mailbox to PDF produces thousands of documents and no way to find anything in them; splitting first, identifying the twenty messages that matter, then converting only those is the difference between an afternoon and a fortnight.

Attachments are inside, and they are why it is so large

Every attachment ever sent or received is in the file, encoded as base64 text. Encoding inflates binary data by about a third, and nothing in the format is compressed, so a mailbox containing four gigabytes of attachments is well over five gigabytes on disk.

One practical consequence: an MBOX compresses extremely well. Zipping an export before storing or transferring it typically halves the size, because base64 text is enormously redundant. If you are keeping a Takeout archive as a backup, keeping it zipped is close to free.

What it is good for, and what it is not

It is an excellent archive. Plain text, a public specification, fifty years of implementations, and a format that will still be readable when every mail client in current use has been replaced. If you want your email to outlive your provider, an MBOX in cold storage is a sound answer.

It is a poor working format. There is no index, so every search reads the whole file; there is no safe concurrent access, so two programs touching it at once can damage it; and there is no per-message metadata beyond what the message itself carries — labels, flags and folder structure are outside the format and are lost or approximated in every migration. Use it to archive and to move, not to live in.

The facts, in one place

Identifiers and provenance for the MBOX format.
Extension.mbox
Media typeapplication/mbox
First published1975
SpecificationRFC 4155

MBOX files: common questions

How do I open an MBOX file?

Thunderbird is the usual route — it reads the format natively and gives you a searchable mailbox. A text editor works for small files. Neither Windows nor macOS has a built-in handler, so double-clicking will not do anything useful.

Why is my Gmail export so large?

Every attachment you have ever received is inside the file, encoded as base64, which inflates binary data by about a third, and nothing in the format is compressed. Zipping the export typically halves it, because base64 text compresses very well.

What is the difference between MBOX and EML?

An EML is one message; an MBOX is an entire mailbox with every message concatenated into a single file. Splitting an MBOX gives you individual EML files, which is usually what people want when they need to read, forward or file specific messages.

Can I import an MBOX into Outlook?

Not directly — Outlook does not read the format. The usual path is to import into Thunderbird first and move the messages across, or to convert to individual message files. This is one of the more common reasons people convert the format at all.

Why do some messages look cut off or merged?

The format separates messages with a line beginning "From ", and a message body containing such a line at the start of a line can be mistaken for a boundary. Implementations have escaped that case differently for decades, so a file written by one program and read by another can show odd breaks. The content is normally intact.

Are my labels and folders preserved?

Only partly. Google Takeout writes one file per label and records the labels in a header, but folder structure and flags are not part of the format itself. Expect a migration to preserve the messages and approximate everything around them.