How I Built a Free MBOX Viewer for the Browser

An .mbox file is email messages stacked one after another in a single plain-text file — and a Gmail Takeout archive can hold 100,000 of them. I built a free MBOX viewer that opens mailboxes that big in your browser, searches every message body, and never uploads a byte. The trick is not parsing email — it is never loading the file.

RFC 4155, published by the IETF in September 2005, defines the application/mbox media type: each message begins with a separator line starting with "From " that names the sender and the date and time it was received. Body lines starting with "From " are stored escaped as ">From ", so a reader can tell content from separators.

Try the free MBOX Viewer — Open Gmail Takeout and Thunderbird .mbox files in your browser, free, no sign-up — with ToolsOfWeb's MBOX Viewer.

Why is opening an .mbox file so hard?

Because most viewers treat the mailbox as one document: they read the whole file into memory, split it into messages, and parse every one before showing anything. A 2 GB Takeout archive breaks that twice: the tab runs out of memory, and you wait minutes just to browse the list. The fix is to never hold the file at once.

Desktop viewers want an install and a licence first; upload-based ones ask you to hand years of private mail to a server you do not control, then cap the free tier and paywall the export. A mailbox is the worst file to handle that way: big, private, and you almost never want all of it — you want one message, or the ten that match a search. So the viewer was built around a different question: how little of the file must we touch to answer what the user asked?

How does the viewer find messages without loading the file?

It scans the file in 4 MB chunks with File.slice, reads each chunk as text, and records only where each message starts and ends — byte offsets plus sender, subject, date and size. The index for 100,000 messages costs a few hundred bytes per message, so the mailbox stays on disk and only the index lives in memory.

The scanner is a small state machine in pure TypeScript, with no dependencies. It walks the file line by line: a line starting with "From " at a message boundary opens a new message, and everything until the next separator belongs to the current one. The hard parts are the edges: a separator can be split across two 4 MB chunks, so the scanner carries the unfinished tail of one chunk into the next; some exporters omit the separator before the first message, so the scanner starts one at byte zero when the file opens with headers. Windows line endings are stripped before a line is judged, and only headers are parsed during the scan, so the index stays small and bodies are never touched. In testing, a 2,000-message, 20 MB mailbox indexed in about 1.2 seconds.

How do I read one message out of 100,000?

By its byte offsets: when you click a message, the viewer slices exactly that message's bytes out of the file and parses only that slice — headers, MIME parts, quoted-printable and base64 bodies, attachments — then renders it. Nothing else is parsed, so opening message 97,431 costs the same as opening message 1.

The index knows every message's start and end byte, so reading one is a single File.slice call followed by the same email parser the site's single-message viewer uses. The list shows 50 messages per page, newest first, so the browser never renders 100,000 rows. Clicking a different message just slices a different range; the rest of the mailbox is never read, never parsed, and never rendered.

How does full-text search work on a file that big?

Search walks the same index and reads each message's slice in turn, checking sender, recipient, subject and body text, with a progress bar and a cancel button. It never builds a search index — it streams through the file using the byte offsets it already has, so a search is slow but bounded and never freezes the tab.

There is no shortcut: searching bodies means reading bodies. What makes it usable is that the work is chunked and interruptible — the scan reports how many messages it has checked, lets you cancel at any point, and yields between slices so the tab stays responsive. A date-range filter and a newest-first or oldest-first sort narrow the work first, and the results feed straight into the export: a metadata CSV of just the matching messages.

How do I keep private mail private while viewing it?

By never sending it anywhere: the file is read by JavaScript in your own tab, so a mailbox never leaves your device. You can prove it by loading the page, going offline, and opening a mailbox — everything still works, because there is no server step at all.

Privacy shaped the reader too. Email HTML is rendered only after scripts are stripped out and external images are blocked by default, because a remote image in a marketing email is a tracking pixel that phones home the moment it loads. Attachments download straight from the local file, and any message can be saved as a standard .eml file. There is no account, no "first 25 emails free", and no paid unlock: the export is the feature, not the upsell.

What did I test before calling it done?

A 2,000-message, 20 MB test mailbox indexed in about 1.2 seconds, and the suite of 29 checks covers the awkward cases: bodies containing "From " lines, files with no separator before the first message, CRLF line endings, huge attachments, and empty or corrupt files that fail with a clear message instead of a frozen tab.

The test list was written from the failure modes. A body line reading "From the team" must not split a message in two — only a "From " line at a message boundary counts. A Thunderbird folder file with no .mbox extension must open as-is, because that is how Thunderbird stores folders. A file that is not a mailbox at all — a .pst or .ost dragged in by mistake — must say so plainly. The same streaming idea worked for the CSV Splitter & Merger and the JSON Formatter: read in chunks, index the boundaries, parse only what the user opens.

FAQs

Is my mailbox uploaded to a server?

No. The .mbox file is read by JavaScript running in your own browser tab and never leaves your device. You can check by loading the page, going offline, and opening a mailbox — everything still works. That matters: a Takeout archive holds years of private correspondence, and it should never be handed to a server-side viewer.

What is an .mbox file?

MBOX is the classic Unix mailbox format: a single plain-text file holding many email messages one after another, each starting with a separator line beginning "From ". It is the format Gmail Takeout gives you and the format Thunderbird stores each folder in. One file can hold a handful of messages or several hundred thousand.

How do I get my Gmail as an .mbox file?

Use Google Takeout: go to takeout.google.com, deselect everything except Mail, and create the export. Google emails you a download link when it is ready. The ZIP contains a file like "All mail including Spam and Trash.mbox" — open that file here. Gmail labels are not folders, so the Takeout mailbox is one big file with every message in it.

Is there a file-size or message limit?

There is no limit imposed by us — no sign-up, no "first 25 emails free", no paid unlock. The viewer scans the file in chunks and builds a lightweight index, then only loads a message in full when you open it, so mailboxes with 100,000+ messages and files of several gigabytes stay usable. The only ceiling is your device's memory.

Can I search inside message bodies?

Yes. Search covers senders, recipients, subjects and the full text of message bodies. Body search scans the file using the index, shows its progress, and can be cancelled — it does not need the whole mailbox in memory. You can also filter by date range and sort newest or oldest first.

Try it with your own mailbox

If you have a Gmail Takeout archive or an old Thunderbird folder, open it with the MBOX Viewer — free, no sign-up, nothing uploaded. A single message file — an .eml, an Outlook .msg or a winmail.dat attachment — opens the same way in the Email File Viewer. A calendar export that came with the mailbox becomes a spreadsheet in the ICS to CSV Converter.