Convert MBOX to CSV on Mac

What converting an MBOX mailbox to CSV on a Mac keeps and loses, where it breaks, and when plain text or the original mailbox is the better choice.

Converting a mailbox to CSV turns a stack of email messages into rows and columns that a spreadsheet, database or script can sort and filter. That works well for some jobs and badly for others. This review explains what the conversion changes, what usually survives it, and how to judge whether the result will serve your purpose on a Mac.

Evidence note: no tested measurements, product comparisons or vendor documentation were supplied for this article. It does not rank or endorse specific converter apps. The points below rest on how the MBOX and CSV formats are generally defined and on standard macOS and Python behavior. Treat any tool-specific claim you find elsewhere as something to verify yourself.

Short answer: is MBOX to CSV the right move?

CSV is a good fit when you want an index of your mail: who sent what, when, and with which subject, for counting, auditing, deduplicating or importing into another system. Its main benefit is that every spreadsheet and most data tools can open it, and it is easy to search and sort.

The decisive tradeoff is structure. An email is a layered document with headers, encoded parts, HTML, inline images and attachments. CSV is a flat grid of text cells. Converting means choosing which pieces become columns and discarding or summarizing the rest. Whatever is not mapped to a column is gone from the CSV, even though it still exists in the original mailbox.

Plain text or the original MBOX is preferable when you need to read conversations as conversations, preserve attachments, keep a faithful archive, or hand records to someone who may need the exact original messages. In those cases, keep the MBOX file and treat any CSV as a derived summary, not a replacement.

What the conversion actually changes

This is a structural conversion, not a visual one. Nothing about fonts, mirroring or text direction is involved; the stored characters are reorganized into a different file layout. Two formats are in play.

MBOX stores many messages one after another in a single plain-text file. Each message begins with a separator line starting with "From " followed by the message's own headers and body. On a Mac, Apple Mail's Export Mailbox command produces a folder ending in .mbox; the messages themselves sit in a file named mbox inside that folder, alongside a small metadata file.

CSV stores records as lines and fields separated by commas. Fields that contain commas, quotation marks or line breaks must be wrapped in double quotes, with inner quotes doubled. TSV is the same idea with tab characters as separators, which can be easier to inspect when message text contains many commas.

A converter reads each message, decodes it, and writes selected parts into columns. The typical mapping and what tends to happen to each part:

Email part | Typical CSV treatment | What can be lost or altered
From, To, Cc | One column each | Multiple recipients collapse into one cell; display names and addresses may be merged or split depending on the tool
Subject | One column | Encoded subjects (non-ASCII text in headers) appear garbled if the tool does not decode them
Date | One column, raw or reformatted | Time zones may be dropped or converted; raw date strings do not sort chronologically as text
Message-ID, In-Reply-To | Optional columns | Often omitted, which removes the information needed to rebuild threads
Plain-text body | One column | Line breaks kept inside a quoted cell; very long bodies may be cut off by spreadsheet cell limits
HTML body | Stripped to text or omitted | Layout, links and formatting are lost or flattened
Attachments | Usually omitted or listed by filename | File contents do not fit in CSV; at best you get names

Because the conversion discards information selectively, two tools can produce very different CSV files from the same mailbox. Before relying on a result, check which columns it created and compare a few rows against the original messages in Mail.

Ways to do it on a Mac

There are three broad routes. Each has a different balance of control and convenience.

  • Dedicated converter apps: convenient, but their column choices, decoding quality and data handling vary. No evaluated examples were supplied here, so check each tool's documentation for which fields it exports and how it treats attachments and character encoding.
  • Email clients with export add-ons: some desktop mail programs can import an MBOX and export message lists to CSV through extensions. Capabilities depend on the specific client and add-on version.
  • A short script: the most transparent option, because you decide exactly which fields are written. Python's standard library includes modules for reading MBOX files, decoding email, and writing CSV.

Online converters require uploading your mailbox. Do not assume anything about how an upload is stored, logged or deleted based on how a site looks or what its marketing says. If a service's written policy does not clearly answer those questions, a local method is the safer default for personal or work mail.

A local script you can inspect

The script below reads an MBOX file and writes one row per message with sender, recipients, subject, date and plain-text body. It decodes encoded headers and character sets, adds an ISO-formatted date column that sorts correctly, and lists attachment filenames without extracting them. It has not been tested against your mailbox, so spot-check the output.

import csv
import mailbox
import sys
from email.header import decode_header, make_header
from email.utils import parsedate_to_datetime


def header(msg, name):
    value = msg.get(name)
    if value is None:
        return ""
    try:
        return str(make_header(decode_header(value)))
    except Exception:
        return str(value)


def decode_part(part):
    payload = part.get_payload(decode=True) or b""
    charset = part.get_content_charset() or "utf-8"
    try:
        return payload.decode(charset, errors="replace")
    except LookupError:
        return payload.decode("utf-8", errors="replace")


def plain_body(msg):
    if not msg.is_multipart():
        return decode_part(msg) if msg.get_content_type() == "text/plain" else ""
    for part in msg.walk():
        if part.get_content_type() == "text/plain" and not part.get_filename():
            return decode_part(part)
    return ""


def attachment_names(msg):
    return "; ".join(
        part.get_filename() for part in msg.walk() if part.get_filename()
    )


def iso_date(msg):
    try:
        return parsedate_to_datetime(msg.get("Date")).isoformat()
    except (TypeError, ValueError):
        return ""


def neutralize(text):
    # Stop spreadsheet apps from treating a cell as a formula.
    return "'" + text if text[:1] in ("=", "+", "-", "@") else text


source, target = sys.argv[1], sys.argv[2]
fields = ["from", "to", "cc", "subject", "date_raw", "date_iso",
          "message_id", "attachments", "body"]

with open(target, "w", newline="", encoding="utf-8-sig") as out:
    writer = csv.writer(out)
    writer.writerow(fields)
    for msg in mailbox.mbox(source):
        row = [
            header(msg, "From"),
            header(msg, "To"),
            header(msg, "Cc"),
            header(msg, "Subject"),
            header(msg, "Date"),
            iso_date(msg),
            header(msg, "Message-ID"),
            attachment_names(msg),
            plain_body(msg),
        ]
        writer.writerow([neutralize(cell) for cell in row])

Save it as mbox_to_csv.py and run it in Terminal, pointing at the mbox file inside the exported folder:

python3 mbox_to_csv.py ~/Desktop/Inbox.mbox/mbox ~/Desktop/inbox.csv

If python3 is not yet available, macOS generally offers to install Apple's command line developer tools the first time you run it. Messages that are HTML-only will have an empty body column in this version; extending it to strip HTML is possible but adds another layer of lossy conversion.

Will the CSV stay readable after opening, copying or sharing?

CSV is plain text, so it survives copying and emailing intact as a file. Problems usually appear when a spreadsheet app interprets it. These are the issues most worth checking:

  • Character encoding: if accented letters or non-Latin scripts turn into odd symbols, the app read the file with the wrong encoding. Writing UTF-8 with a byte order mark, as the script above does, helps some spreadsheet apps detect it; importing through the app's text import option and choosing UTF-8 is the more reliable fix.
  • Multi-line bodies: properly quoted line breaks keep a message in one cell, but some tools and quick text viewers break such rows apart. If the row count looks higher than your message count, this is the likely cause.
  • Cell size limits: spreadsheet apps cap the amount of text a single cell can hold, so very long messages may be truncated on opening even though the CSV file itself is complete.
  • Formula interpretation: a cell starting with =, +, - or @ may be treated as a formula. That can corrupt displayed values and, with untrusted mail, poses a security risk. The neutralize step prefixes such cells with an apostrophe, which changes the stored text slightly; remove that step if the CSV is going to a database rather than a spreadsheet.
  • Dates: raw email date strings sort alphabetically, not chronologically. Use the ISO column for sorting, and note that converting to local time can shift a message to a different calendar day.
  • Delimiters and locale: in some regional settings, spreadsheets expect semicolons rather than commas. If everything lands in one column, import with an explicit delimiter or use TSV instead.

For search and editing, CSV is an improvement over MBOX: you can filter by sender or keyword across thousands of messages at once. Editing the CSV, however, does not change the mailbox, and an edited CSV can no longer be trusted as a record of what was actually sent.

On accessibility, a spreadsheet of short fields such as sender, subject and date is generally navigable with a screen reader cell by cell. Long message bodies inside single cells are harder to read that way, and losing thread structure removes the context that makes replies understandable. No assistive technology testing was supplied for this article, so if the CSV will be used by someone relying on a screen reader, test it with their actual setup. When the purpose is reading the messages rather than analyzing them, a plain-text export of each message, or the original mail client, is the more usable equivalent.

Checks before you rely on the result

  • Compare the number of CSV rows with the number of messages shown for that mailbox in Mail.
  • Open a few messages with non-English text, emoji or unusual subjects and confirm they match the originals.
  • Confirm whether attachments, HTML-only messages and threading information matter for your task, and whether the CSV kept them.
  • Keep the original MBOX export alongside the CSV.
  • If the mail contains sensitive information, decide where the CSV will be stored and shared before you create it, since a spreadsheet is easier to circulate than a mailbox file.

Bottom line

Converting MBOX to CSV on a Mac is worthwhile when you need a searchable, sortable list of messages and can accept losing formatting, attachments and most thread structure. It is the wrong tool for archiving, legal or compliance records, or comfortable reading of conversations; for those, keep the MBOX file or export plain-text copies. Whatever method you use, verify encoding, row counts and a sample of messages before treating the CSV as accurate.