GuideUpdated October 21, 2026

Sort Gmail automatically: filters, labels, tabs and AI

Gmail sorts incoming email with filters. A filter is a saved search plus an action: "everything from news@shop.example gets the label Newsletters and skips the inbox". On top of that, the default inbox splits promotions, social updates and notifications into tabs without any setup. An AI agent only earns its place once your criteria stop fitting into a search query.

This guide covers Gmail's own tools first, then their limits, then the agent options. One of those is Command Mail, which we build. It works on copies of your email and doesn't touch your Gmail account, so if you want Gmail itself tidy, filters are the tool to use.

Updated: Fact-checked: About 8 min readAs Markdown

Contents
  1. What you'll end up with
  2. Before you start
  3. Which Gmail tool does what?
  4. Step by step: a filter that applies a label
  5. Writing precise criteria with search operators
  6. Cleaning up older mail
  7. Inbox category tabs
  8. Check that it works
  9. Troubleshooting
  10. When an AI agent does more
  11. Next steps
  12. Sources and date
  13. Frequently asked questions
  14. Sources

01What you'll end up with

Newsletters, receipts and shipping notices get a label on arrival, and the ones you don't need to see right away never land in your inbox. You know which filter moves which email and can edit or remove each one.

02Before you start

You need a Gmail account and a computer with a browser; Google documents filters and categories for Gmail on the web.[1][2] This guide follows the browser.

It helps to drop the idea of folders. Gmail has labels. One email can carry "Invoices" and "Taxes 2026" and still sit in your inbox. Delete it and it disappears from every label at once.[3] What Outlook calls moving to a folder is, in Gmail, applying a label and archiving.

03Which Gmail tool does what?

ToolWhat it doesGood forLimit
FilterRuns actions when an email matches search criteriaKnown senders, subject keywords, mailing listsOnly what you can express as a search
LabelTags email; one email can have severalTopics and projectsDoesn't sort anything without a filter
Category tabsSplits into Primary, Social, Promotions, Updates, ForumsSeparating bulk mail from peopleNo custom tabs
Multiple inboxes layoutShows sections built from searches or labelsSeveral topics at a glanceChanges the view only
AI agentReads content and proposes groups or rulesFuzzy criteria, mixed sendersNeeds access and clear permissions

04Step by step: a filter that applies a label

  1. Create the label. In the left sidebar, click the plus next to Labels ("Create new label"), type a name and click Create. Tick "Nest label under" if it belongs under another label.[3]
  2. In the search box at the top, click Show search options.[1]
  3. Fill in the criteria, for example the sender address or a word from the subject line.
  4. Click Search and look at the results. If the wrong emails show up, fix the criteria now.
  5. Open the search options again and click Create filter at the bottom.
  6. Pick the actions: apply a label, archive, mark as important, assign a category, star, forward or delete.[1][2] For newsletters, a label plus archiving is usually enough.
  7. Click Create filter.

The shortcut starts from an email you already have: tick the box next to it, open the More menu and choose Filter messages like these. Then review or add criteria, click Create filter, and pick actions as in step 6.[1]

05Writing precise criteria with search operators

The form handles simple cases. Search operators, typed straight into the search box and then turned into a filter as above, get you further.[4]

  • from:billing@vendor.example finds email from that sender.
  • list:info@example.com finds email from the mailing list with that address.
  • has:attachment limits the filter to emails with attachments.
  • category:promotions matches what Gmail already treats as promotions.
  • from:amy OR from:david covers two senders with one filter.
  • A leading - excludes a term, as in -from:boss@company.example.

Run every query with Search before turning it into a filter. Google notes that conversations can still show up for excluded criteria, because Gmail matches individual messages first.[4]

06Cleaning up older mail

For forwarding filters Google states plainly that only new messages are affected.[1] Google's filter help doesn't say whether other filters reach existing mail. The safe way to sort the backlog is by hand: run the same search, tick the boxes of the emails you want, and apply the label from the Labels button at the top.[3] You see every email it touches before anything moves.

07Inbox category tabs

With the Default inbox type, Gmail files mail into five categories on its own: Primary for people you know, Social, Promotions, Updates for confirmations, statements and reminders, and Forums for groups and mailing lists.[2]

To choose your tabs, click Settings at the top right, pick Default under Inbox type, click Customize, tick the categories you want and Save. You can't create your own categories.[2] Google also says the Default inbox type isn't available once your inbox holds more than 250,000 emails.

If an email ends up in the wrong tab, drag it to the right one; Gmail learns from that over time. For a fixed rule, create a filter that assigns a sender's email to a category.[2] One side effect: with new-mail notifications on, you only get notified for Primary.

If five tabs aren't enough, the Multiple inboxes layout adds sections to your inbox built from labels or search operators, for example one section for label:clients.[5]

08Check that it works

Wait for a real email that matches, such as the next newsletter. It should carry the label and, if you chose to archive, stay out of the inbox. All your filters live under Settings → See all settings → Filters and Blocked Addresses. You can edit or delete them there, and Export saves them as an XML file you can import again later.[1] For the first week, glance at your labels and the Promotions tab daily so mistakes surface early.

09Troubleshooting

An archived email seems to be gone. Archived email doesn't appear in any category tab. Look in All Mail or under its label.[2]

A reply lands back in the inbox. Google explains that a reply to a filtered email is only filtered if the reply itself matches the criteria.[1] If senders vary, filter on something broader such as list: with the list address, or the sender domain.

The filter catches too much. Open it under Filters and Blocked Addresses, add an exclusion with -, then click Continue and Update filter.[1][4]

A label is empty after you deleted emails. Labels aren't copies; deleting an email removes it from every label.[3]

You see a forwarding notice you didn't set up. Google's advice: change your password right away and turn off forwarding in settings.[6]

10When an AI agent does more

Filters break down on requests like "anything that reads like marketing, unless it's from a client" or "every invoice, whoever sends it". An agent can read the content and group email by what it is. There are three routes.

Claude inside your Gmail account. According to Anthropic, Claude's Google Workspace connector can search and read email and manage labels and threads. By default Claude asks before each of those actions; on Team and Enterprise, owners decide whether members may let them run without asking.[7] Anthropic's feature list doesn't mention creating Gmail filters, so Claude tidies up when you ask, and lasting rules still belong in Gmail. Anthropic also notes that some advanced Gmail filters may not be supported. Setup and limits are in Connect Gmail to Claude.

Google's Gmail MCP server. Google offers its own MCP server with tools to add and remove labels and no tools for sending or deleting. It's a Developer Preview that requires an application and your own Google Cloud project.[8] For most people that isn't an everyday option yet; see Gmail MCP server options.

Command Mail as a separate inbox. Command Mail receives your Gmail as copies through forwarding, alongside addresses from other providers. Gmail forwards all new mail except spam once you have confirmed the destination address through a verification link, turned automatic forwarding on and saved; Google recommends keeping Gmail's copy in the inbox.[6] Nothing you do in Command Mail changes your Gmail account. An agent such as Claude, ChatGPT or Codex sorts there over MCP.[10] A Command Mail rule targets exactly one sender address or sender domain, optionally narrowed by a type of email, subject words or a mailbox. Its action is spam, archive, a folder or trash. A rule that names no type only matches routine mail such as newsletters, promotions and notifications. Domains of large providers like gmail.com can't be a rule target. Mail recognized as an invoice, a deadline or a security notice is never sent to spam or trash by a rule.

How much the agent may do on its own is set per mailbox. On suggest, archiving, spam, trash, category and folder changes by the agent wait for your confirmation, including matches of enabled rules. Labels, read status and stars, by contrast, the agent changes immediately on any level above read-only. On rules, enabled rules act on new mail by themselves while the agent's other sorting stays a suggestion; only auto lets it organize directly.[9] A mailbox without its own setting inherits the row Catch-all and new mailboxes, and if that's empty too, auto applies. So check each mailbox under Automation & rules before the agent's first run. The free plan covers reading, search and sorting for one mailbox and the last 90 days, without sending.[9] Clean up your inbox with AI walks through a careful first run.

If you want your Gmail account itself in order, Gmail filters plus, optionally, Claude's connector are the right fit. Command Mail fits when you want Gmail merged with addresses from other providers and an agent working there under fixed permissions.

11Next steps

Start with three filters for the senders that annoy you every day and switch on the category tabs. A week later you'll see what still slips through. Only then is an agent worth adding, with the narrowest permission the job needs. If you juggle several addresses, read All your email addresses in one inbox. For Outlook there's a matching guide: Sort Outlook email automatically.

12Sources and date

Last checked: 2026-10-21. The Google and Anthropic help pages and Command Mail's public pages were retrieved that day; Google's MCP reference on 2026-10-19. Statements about Command Mail rules and autonomy levels also rest on the app code at commit d6ad1ce. This guide doesn't include our own test of Gmail's menus.

Frequently asked questions

How do I make Gmail move emails to a folder automatically?

Gmail uses labels instead of folders. Create a filter: click Show search options in the search box, enter criteria such as the sender, click Create filter, and add an action that applies your label. If you also want the email out of your inbox, add the archive action.

Can I add my own inbox tabs?

No. Google says you can only choose from the existing categories Primary, Social, Promotions, Updates and Forums. For your own groups, use labels; the Multiple inboxes layout can show labels as extra sections in your inbox.

Does a new filter apply to emails I already have?

For forwarding filters Google says explicitly that only new messages are affected. The safest way to handle older mail is to run the same search, select all results and apply the label from the Labels button yourself.

What is the difference between a label and a folder?

One email can carry several labels and still stay in your inbox. According to Google, deleting an email removes it from every label at once. Labels are private; people you email don't see them.

Can an AI agent sort my Gmail for me?

Claude's Google Workspace connector can manage labels and threads, and by default asks before each such action, according to Anthropic. Anthropic's feature list doesn't include creating Gmail filters that keep running without Claude. Command Mail sorts copies of your Gmail in a separate inbox and leaves your Gmail account unchanged.

Sources

  1. Google: Create rules to filter your emails support.google.com, accessed
  2. Google: Sort emails into categories support.google.com, accessed
  3. Google: Create labels to organize Gmail support.google.com, accessed
  4. Google: Search operators you can use with Gmail support.google.com, accessed
  5. Google: Change your Gmail inbox layout support.google.com, accessed
  6. Google: Automatically forward Gmail messages to another account support.google.com, accessed
  7. Anthropic: Use Google Workspace connectors support.claude.com, accessed
  8. Google: Configure the Gmail MCP server (Developer Preview) developers.google.com, accessed
  9. Command Mail: plans and agent permissions commandmail.app, accessed
  10. Command Mail: documentation commandmail.app, accessed
EN