Skip to content
LabelKeep

Split a Gmail Takeout mbox into per-label folders of .eml files

Gmail Takeout hides your labels in the X-Gmail-Labels header and importers collapse everything into one pile. LabelKeep reads that header and rebuilds proper per-label folders of .eml files, entirely in your browser.

Preview your files

Free preview US$5 per mailbox export

Files stay on your device. No account needed.

labelkeep-demo.mboxSource file
MBOX
Folder structure
One flat Imported folder
Label data
Hidden in X-Gmail-Labels header
labelkeep-labels/Sample result
31 labels842 .emlNesting kept

MBOXInput format

LabelsOutput format

Local processingFiles stay in your browser

842 messages, 31 labels, nothing lost

What makes this file tricky

Gmail Takeout exports one giant MBOX where the only record of each label lives in a non-standard X-Gmail-Labels header; standard mail importers (Thunderbird, Apple Mail, Outlook) ignore that header and dump every message into a single folder. A message can also carry several comma-separated labels at once, which naive splitters either lose or force into just one bucket.

What the tool accepts

Reads the X-Gmail-Labels header that Google Takeout writes (mbox format). A message with several labels is copied into each of its label folders so every folder is complete; labels-index.csv keeps the full mapping. Label names containing a comma are not supported (comma is Gmail's separator). Works up to about a 2 GB mbox in one pass — split larger exports in Takeout. Opening .mbox.gz needs a current browser (Chrome, Edge, Firefox, Safari).

From source file to export

  1. Open the source file

    In Google Takeout, export Mail and choose the .mbox format, then unzip to get the .mbox file.

  2. Check your preview

    Open that .mbox (or .mbox.gz) here and check the label folders and message counts in the preview.

  3. Save the export

    Download the ZIP: each Gmail label is its own folder of .eml files, plus labels-index.csv. Import a folder into your mail client or open any .eml directly.

Read the step-by-step guide

Open LabelKeep

Try a sample or open your own files. The preview runs in this browser.

Source files

MBOX

No files selected.

Preview & export

Labels

Choose a file or try the sample to see the result here.

What the sample produces

The demo MBOX holds 842 messages tagged across 31 labels, including nested labels like Work/Standups and mail carrying two labels at once. LabelKeep rebuilds the exact label tree as folders and writes each message as a standalone .eml, copying multi-label mail into every folder it belongs to.

labelkeep-labels/

Folder structure
31 per-label folders
Label data
Read from X-Gmail-Labels
Messages
842 preserved as .eml

LabelKeep and other ways to do the job

Comparison of LabelKeep and other tools
ToolWhat it does
LabelKeepThe demo MBOX holds 842 messages tagged across 31 labels, including nested labels like Work/Standups and mail carrying two labels at once. LabelKeep rebuilds the exact label tree as folders and writes each message as a standalone .eml, copying multi-label mail into every folder it belongs to.
Takeout mbox splitter (Python gist)Free Python script that splits a Takeout mbox into .eml files in folders built from labels, year and month.
Univik MBOX SplitterWindows app that splits a Takeout mbox by Gmail label; outputs .mbox, and the trial writes only 10 messages per file. US$39 one-time licence.

The links describe each alternative's documented workflow.

Preview for free. Pay when you download.

Free preview

$0

Open a sample or your own files and inspect the result before deciding whether to export.

Full export

US$5 per mailbox export

Pay once to download the full result shown in your preview.

Already paid? Restore your purchase.

Frequently asked questions

Where does Gmail actually store my labels in the Takeout file?

In a header called X-Gmail-Labels at the top of each message, as a comma-separated list. It is a Gmail-only header, which is why Thunderbird, Apple Mail and Outlook ignore it and pile everything into one folder. LabelKeep reads that header to decide which folder each message goes into.

What happens to an email that has more than one label?

It is copied into every matching label folder, so a message tagged Receipts and 2024 ends up as a full .eml in both. Nothing is dropped and no label is silently picked over another. The original MBOX is left untouched.

Do my nested labels like Work/Standups stay nested?

Yes. A label such as Work/Standups becomes a Work folder with a Standups folder inside it, matching the slash structure Gmail uses. The full label tree is rebuilt as real folders of .eml files.

Can I import the result back into a mail app or just open the files?

You get plain .eml files, which open in Thunderbird, Apple Mail, Outlook and most mail clients, and can be dragged into a folder to re-import. LabelKeep only splits and writes files locally; it does not connect to your Gmail account or change the original MBOX.

How much does LabelKeep cost?

The preview is free. Each mailbox export is US$5, charged once at download.

Do my files get uploaded?

Your files are processed in your browser. Stripe handles checkout separately.

Do I need an account to pay or download?

No account is needed. Complete Stripe Checkout and return to this browser to download the result.

Can I come back to finish a paid download?

Open this tool in the same browser and select Restore purchase. Prepared exports are kept locally for up to seven days.

Guides and support

Try LabelKeep with a sample

Open the tool and preview the result for free.

Open the tool