All posts

How to Convert an MBOX File to CSV (Email Addresses, Names and Counts)

··2 min read

To convert an MBOX file to CSV, open it in the MBOX to CSV tool. It reads only the message headers, in your browser, and lists every From, To and Cc address with the most used name, how many messages each appears in, and when it was first and last seen, ready to download as a CSV. Nothing is uploaded.

Convert an MBOX file to CSV →

Convert with the tool

  1. Export your mail as .mbox: Google Takeout for Gmail (choose Mail), the ImportExportTools NG add-on in Thunderbird, or Mailbox › Export Mailbox in Apple Mail. Unzip the Takeout download first.
  2. Open the MBOX to CSV tool and choose the .mbox file. Several files or single .eml messages work too.
  3. Add your own addresses so they're left out.
  4. Press Extract addresses. A multi-gigabyte export is read in pieces, with a progress counter.
  5. Filter out no-reply senders, or keep only people you wrote to, then download the CSV with names, counts and first and last seen dates.

Convert with a script

This uses only Python's standard library. It decodes encoded names like =?UTF-8?Q?Ren=C3=A9?= and counts how often each address appears in From, To and Cc:

import csv, mailbox, sys
from collections import Counter
from email.header import decode_header, make_header
from email.utils import getaddresses

counts, names = Counter(), {}
for msg in mailbox.mbox(sys.argv[1]):
    fields = [str(make_header(decode_header(v))) for h in ("From", "To", "Cc") for v in msg.get_all(h, [])]
    for name, addr in getaddresses(fields):
        addr = addr.strip().lower()
        if "@" in addr:
            counts[addr] += 1
            names.setdefault(addr, name)

with open("addresses.csv", "w", newline="") as f:
    w = csv.writer(f)
    w.writerow(["email", "name", "messages"])
    for addr, n in counts.most_common():
        w.writerow([addr, names[addr], n])

Save it as mbox2csv.py and run python3 mbox2csv.py your-export.mbox. It reads every message, so a large export takes a while.

For a quick address-only list, grep works, but it misses headers folded onto a second line and doesn't decode names:

grep -E -i "^(From|To|Cc):" export.mbox \
  | grep -E -o "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}" \
  | tr 'A-Z' 'a-z' | sort | uniq -c | sort -rn > addresses.txt

Before you use the CSV

  • Remove your own addresses and automated senders (no-reply, notifications, mailer-daemon).
  • Permission: having emailed someone isn't consent to marketing. See GDPR and B2B cold email.
  • Age: addresses from years-old threads bounce more. See mailing an old email list.

Google's Takeout help page (read 8 November 2026) also notes that "each message's labels are preserved in a special X-Gmail-Labels header in your download file", which you can read with msg["X-Gmail-Labels"] in the script if you want to filter by label.

Next step: verify the addresses

Upload the CSV at /verify. Each address gets a live mailbox check without sending, and you can export valid, risky and invalid rows separately. The first 100 checks are free with a Google sign-in, no card.

Pro, $39 a month: Unlimited email verification.* Never metered, never cut off. See pricing.

*Fair use: the first 100,000 checks a month at full speed, then slower, never cut off.

More: export the email addresses you've emailed from Gmail, remove duplicate emails.

Common questions

How do I convert an MBOX file to CSV?

Open the .mbox file in the MBOX to CSV tool, add your own addresses so they're left out, press Extract addresses, and download the CSV. It runs in your browser, so the file isn't uploaded.

Does the converter read the email bodies?

No. It reads only the message headers (From, To, Cc and dates) to build the address list.

Can it handle a large Gmail export?

Yes. A multi-gigabyte export is read in pieces with a progress counter. Unzip the Takeout download first.

Can I convert MBOX to CSV with a script?

Yes. The Python script in this post uses only the standard library (mailbox, email.header, email.utils, csv) and writes email, name and message count.

Check your list before you send

Real mailbox checks over SMTP, and nothing is sent to the address. Sign in with Google and your first 100 email checks are free, no card. Plans for bigger lists are on the pricing page.