Skip to content
Mbox Viewer Pro
mboxgmailformatsarchives

Why Your MBOX File Is Bigger Than Your Mailbox

Gmail says 8 GB, the Takeout MBOX weighs 11. Nothing was added: base64 costs a third, headers can outweigh the text, most messages travel twice, and labels duplicate. Where each missing gigabyte goes.

David Carrero ·

Gmail says your mail takes up 8 GB. The Takeout lands and the MBOX weighs 11. Nothing was added and nothing is wrong: an MBOX is not a copy of your mailbox, it is a transcription of it into plain text, and the transcription is bigger than what it transcribes. Six things account for the difference, and the first one accounts for most of it.

Attachments are stored as base64, which costs a third

This is the big one, and it is arithmetic rather than opinion.

Email is a seven-bit text channel by inheritance. SMTP was specified in 1982 for US-ASCII text, and much of the infrastructure still assumes a message is printable characters and nothing else. A JPEG is not, so it has to be rewritten as some. Base64 does that by taking three bytes at a time and writing them as four characters from a 64-symbol alphabet.

Three in, four out. That is exactly 33.3% more, before anything else. Then the encoding wraps at 76 characters and adds a line break, which is another 2.6%. Call it 37% in practice: a 3 MB attachment occupies about 4.1 MB inside the MBOX.

In most personal mailboxes attachments are the bulk of the weight, so this mechanism alone explains the greater part of the gap. And they never sit in a separate folder: every photo anyone ever sent you is in that file, spelled out in letters and digits.

Every message carries its full headers, and they are not small

What you read at the top of a message is four lines: from, to, date, subject. What is actually stored is the whole header block, and most of it was never meant for you.

Each server that handled the message added a Received line recording where it came from and when — five or six hops is normal, at 100 to 200 bytes each. A DKIM signature with a 2048-bit key ends in 344 characters of base64, and messages routinely carry two. Add the Message-ID, the authentication results, the list headers, the spam scores and the MIME declarations, and the header block of an ordinary message that passed through Gmail runs from two to six kilobytes.

Now consider a reply that says “Ok, thanks.” Ten bytes of text wrapped in four thousand bytes of envelope. Twenty thousand short messages like that are 80 MB of headers and almost no mail.

Most messages are in the file twice, in two formats

Nearly every message a modern client sends is multipart: a multipart/alternative container holding a plain-text version and an HTML version of the same words, so whatever opens it finds something it can render.

The plain-text copy is cheap. The HTML one is not: inline CSS, table layouts, tracking parameters on every link. A newsletter whose readable text is 2 KB arrives as 60 KB of markup. You read one of the two. You store both.

Gmail labels can write the same message more than once

Ask Takeout for “All Mail” and each message is written once, with an X-Gmail-Labels header listing every label it carries. Ask for a set of individual labels instead, and a message that is in Inbox, in Work and in Invoices can be written once for each. Check yours before you assume: pick a Message-ID from the file and count how many times that exact string appears in it.

The other duplication is one you create. Two Takeout exports six months apart, merged, contain the overlapping period twice — which is what deduplication by Message-ID is for. And in a long thread every reply quotes everything before it, so the first message of a ten-message thread is in the file ten times.

The number Gmail showed you was never measuring the same set of messages

Before blaming the format, check that both ends of the comparison count the same thing. The storage figure most people quote is the account total across Gmail, Drive and Photos; the per-service breakdown is a different page. Spam and Trash count toward Gmail’s usage, and Takeout treats them as separate labels you have to tick.

Google has never documented how it accounts for a stored message internally, and guessing is not useful. What can be verified is the file on your disk.

Accents cost three bytes per character in quoted-printable

Text bodies that are not pure ASCII are usually encoded as quoted-printable, which keeps ordinary letters as themselves and rewrites anything else as = plus two hex digits. In UTF-8 an accented Latin character is two bytes, so it becomes six characters: é is =C3=A9.

Spanish, French or Polish prose grows by a few percent. Japanese and Korean are three bytes per character in UTF-8, which becomes nine — text can triple. Which charset and encoding a sender chose is visible in the message headers, and it is why the same twenty thousand messages weigh noticeably more in some languages than in others.

What actually helps, and what you don’t need to bother with

Compress it. An MBOX is text, and text compresses. The catch is that most of the bulk is base64’d JPEGs and PDFs that were already compressed before they were encoded, so zipping mainly gives back the 33% base64 added. Expect an 11 GB archive to land somewhere between 4 and 8 GB as a .zip or .gz — closer to 8 if it is mostly attachments, closer to 4 if it is mostly text.

Deduplicate before you merge, not after. And pull the attachments out if what you want is the invoices rather than the mail.

The honest last point is that none of this may be necessary. Size is only a problem for a program that insists on loading the file into memory first. A streaming parser walks it message by message and never holds more than one at a time, and a binary index built on the first pass records where each message starts, so reopening is instant. That is how Mbox Viewer opens a 50 GB MBOX in under five minutes and stays below 600 MB of RAM.

So you are allowed to keep the 11 GB. It is text, it is self-contained, and it will still open in twenty years — which was the whole point of the format being wasteful in the first place.

Open your archive with Mbox Viewer

Native app for Mac, Windows and Linux. Streams MBOX and EML files of any size, fully offline.

Or download it directly from our site