How to Export Gmail with Google Takeout
On this page
Google Takeout creates a downloadable copy of your Gmail messages and attachments. The messages come in MBOX, a file format that email programs can open or import. The download is usually a ZIP file. Extract it to find the MBOX files.
Takeout lets you keep an offline copy or move messages into another email program. It does not delete mail from Gmail, and the export is not ready to browse in Gmail’s web interface. For email saved as separate, searchable files on your computer, try mailmd, a free, open-source alternative.
Export Gmail with Takeout #
- Open Google Takeout and sign in to the account that holds the Gmail messages.
- Select Deselect all, then scroll to Mail and select it. This keeps the export focused on Gmail.
- Choose All Mail data included to export everything. To export selected messages, clear Include all messages in Mail, choose the Gmail categories (labels) you want, and select OK.
- Select Next step. For a one-time download, choose Send download link via email, Export once, and .zip.
- Choose an archive size, then select Create export.
Google prepares the archive and sends a download notification when it is ready. Google’s Takeout instructions say preparation takes from a few minutes to a few days. If the export is split into multiple files, download every part. Takeout download links expire after about seven days, and each archive allows five downloads.
Extract and open the exported messages #
Extract the ZIP file or files. Find the MBOX files in the Takeout folder that appears. ZIP is the compressed package; MBOX contains the email data.
On a Mac, Apple Mail can import MBOX files through File → Import Mailboxes. The imported messages appear in an Import mailbox. In Thunderbird, the ImportExportTools NG extension provides MBOX import options.
Before relying on the export, open a few old and recent messages. Check important attachments and sent messages, and make sure you extracted every part of the archive. Keep the original download until you have verified the messages you need. Importing an archive into a mail program does not necessarily recreate Gmail’s organization: Takeout preserves labels in message metadata, but an importing program may not turn those labels into folders.
Export a selected group of messages #
Takeout lets you select Gmail labels, which group messages by category, rather than enter a date range directly. In Gmail, apply a dedicated label to the messages you want, then select that label in Takeout. A Gmail label is a way to categorize messages; it does not work exactly like a traditional folder.
To export messages from a date range, search Gmail with date operators such as after: and before:. Review the results, then apply a label to those messages before exporting. This is a way to prepare a selection in Gmail, not a built-in Takeout date filter. Google documents these operators in its Gmail search instructions.
What Takeout includes, and what it does not #
A Gmail export includes message content and headers. It also includes attachments and label information. Google also lists some Gmail settings, such as signatures and filters, as exportable data. Importing the MBOX files does not restore those settings. Google’s Gmail export documentation also says that encrypted messages remain encrypted in the download and that the export covers data that has not been deleted.
Takeout creates a copy, so exporting does not free Gmail storage. Check that the archive opens and contains the messages you need before deleting anything from the mailbox.
For work or school accounts, an administrator can restrict Takeout. If Mail is missing from the export choices, ask the account administrator whether the account allows Takeout exports. Google’s Workspace guidance also notes that suspended users cannot download data through Takeout.
When mailmd is a better fit #
Takeout is suited to a one-time Gmail export in MBOX format. mailmd instead copies email into a folder on your computer, with one Markdown file per message. Markdown is plain text with simple formatting, so the files can be opened in editors and searched with tools such as grep or rg. Attachments sit beside their messages, and --keep-raw also saves the original .eml message file.
mailmd works with Gmail and other mailboxes that use IMAP, a standard for accessing email. To connect through Google's Gmail API, a way for software to access Gmail, mailmd requires an OAuth app set up in Google Cloud. It also connects to Gmail through IMAP using an app password. The tool reads mail without marking messages as read or changing the mailbox. If you later remove messages from the server, mailmd keeps the files it saved on your computer. It is not a mail client, does not import mail back into Gmail, and does not free mailbox storage by itself.
To try it, visit mailmd.dev or its open-source repository. A basic manual setup is to install mailmd, connect the mailbox, and run mailmd sync. For Gmail API access, create the OAuth app first; for Gmail over IMAP, use an app password if Gmail requests one.
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.