Email files explained

How to Import an MBOX File into Gmail

Updated 3 min read

With mailmd How to Delete a Gmail Account Without Losing Your Emails
On this page
  1. Import the MBOX file with Thunderbird
  2. Use Apple Mail on a Mac
  3. Check large imports and protect account access

If you have an MBOX file of saved email, Gmail’s website does not provide a direct way to upload it. MBOX is a file format that stores email messages together. To move those messages into Gmail, use a desktop mail program such as Thunderbird or Apple Mail to open the file, then copy the messages to your Gmail account.

Thunderbird is a practical choice for most people because it runs on different computer platforms. The transfer uses IMAP, a method that lets a mail program sync messages with Gmail. Large imports can stop before they finish. After copying, check the message count and transfer the mail in batches if needed.

Import the MBOX file with Thunderbird #

Thunderbird can read an MBOX file with the ImportExportTools NG add-on. After importing the messages into a local Thunderbird folder, copy them to a folder under your Gmail account; this uploads them to Gmail.

  1. Install Thunderbird and connect your Gmail account. Add the account in Thunderbird and sign in through Google’s authentication window. If Thunderbird cannot access Gmail, check Gmail’s settings for IMAP access. The Thunderbird import method uses Gmail’s IMAP connection to transfer messages.
  2. Install ImportExportTools NG. In Thunderbird, open the Add-ons Manager, find the add-on, install it, and restart Thunderbird if prompted. Check that the add-on supports your Thunderbird version before proceeding.
  3. Create a local folder for the imported mail. Under Local Folders, create a folder with a clear name, such as “Archived mail.”
  4. Import the MBOX file. Right-click the local folder and use the add-on’s MBOX import option to select the file. If you downloaded a Google Takeout archive, extract the downloaded ZIP file first, then locate the MBOX file inside it. Google Takeout exports can contain multiple MBOX files; a Gmail export may include one file per label, while an AllMail file contains all records, according to Backupify’s description of Gmail exports.
  5. Copy messages into Gmail. Open the imported local folder, select a manageable batch of messages, and drag them to a folder under your Gmail account in Thunderbird. Repeat until you have transferred the messages you want.

When you copy messages to a Gmail folder, Thunderbird uploads them through IMAP. The destination folder appears in Gmail as a label. Keep Thunderbird open while it transfers mail, and confirm that the messages appear in Gmail before removing the local copy.

Use Apple Mail on a Mac #

Apple Mail offers a built-in MBOX import option. Choose File > Import Mailboxes, select the MBOX file, and complete the import. Then locate the imported mailbox. With the Apple Mail method, drag its messages to the Gmail mailbox in Apple Mail, copying them into your connected Gmail account.

If Apple Mail is not connected to Gmail, add the account before moving any messages. Check the message count in Gmail afterward, since a completed import into Apple Mail does not confirm that the upload to Gmail finished.

Check large imports and protect account access #

Large transfers can stop before every message reaches Gmail. In one Mozilla Support discussion, a user reported that a transfer of nearly 12,000 messages stopped after about 245. The cause was not established, but a responder recommended transferring large amounts in smaller batches and checking the result. This Mozilla Support discussion shows why you should check the message count instead of assuming the transfer finished.

Before starting, keep an untouched copy of the MBOX file. For a large archive, import and upload one folder or batch at a time, then compare the number of messages in Thunderbird with the messages visible in Gmail. The cited sources do not give Google’s upload limits. For a very large archive, do not rely on one uninterrupted transfer.

A third-party importer is another option, but it requires granting software access to your Gmail account. Review the requested permissions and use a provider you trust. The available sources do not independently confirm vendors’ claims about import limits or preserved folder structure.

Free and open source

Try mailmd

mailmd is a free command-line tool that copies your email into Markdown files on your computer, one file per message. It works with any IMAP mailbox, and with Gmail and Outlook through their own APIs.

Install

$ curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh

Set it up with your coding agent

Set up mailmd so you can read my email. Use https://github.com/vincentsch/mailmd: read its AGENTS.md and follow the steps. Connect my mailbox and run the first sync. Then show me where the files are.

More on email files explained