GuideUpdated November 30, 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, with the Default inbox type Gmail splits promotions, social updates and notifications across the category tabs you select, as long as smart features are on. 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 sorting by sender or size, Gmail's AI features, and finally 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: Published: Fact-checked: About 15 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. Sorting Gmail by sender, size or date
  7. Cleaning up older mail
  8. Inbox category tabs
  9. Gmail's own AI: tabs, smart features and AI Inbox
  10. Check that it works
  11. Troubleshooting
  12. When an AI agent does more
  13. Connect Command Mail to your agent
  14. What changed on this page
  15. Next steps
  16. Sources and date
  17. Frequently asked questions
  18. 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 and from your inbox.[3] What Outlook calls moving to a folder is, in Gmail, applying a label and archiving. You can create up to 5,000 labels.[3]

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 apply itself; combine with a filter for automation
Category tabsSplits into Primary, Social, Promotions, Updates, ForumsSeparating bulk mail from peopleNo custom tabs; automatic categorization needs smart features
Inbox typesUnread, starred or important first, or several sectionsOrder and overviewChange the view only
AI Inbox (beta)Shows to-dos and topics from the Primary tabSeeing what mattersUS and English only; no automatic moving described
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. At the bottom of the search window, click Create filter.[1]
  6. Pick the actions. Google mentions applying a label, archiving, deleting, starring and forwarding; its category help adds that a filter can mark a sender's email as important or send it to a specific category.[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, click More 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; filename:pdf to emails with a PDF attached.
  • 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's search operator page has the full list with examples.[4]

06Sorting Gmail by sender, size or date

Google's guide for people coming from Outlook doesn't describe sorting Gmail's message list by sender or size. It answers Outlook's Sort menu with inbox types, newest-or-oldest order and search.[13] These narrow the messages shown, but don't order the whole list by sender or size. Here's what helps:

  • By sender: from:name@example.com searches for email from that sender; add in:anywhere to include Spam and Trash.[4] For newsletters and promotions, click More → Manage subscriptions on the left. It shows each sender with an active subscription next to the number of emails they sent recently, and clicking a sender's name or avatar opens all their email. Google is rolling this view out gradually, so you may not have it yet.[15]
  • By size: Google lists size:, larger: and smaller: and gives the examples size:1000000 and larger:10M.[4]
  • By date: Point to the numbers above your inbox, such as "1–50 of 1,234", and choose Oldest or Newest.[13] Search results switch from Most relevant to Most recent above the results, and older_than:1y or before:2026/01/01 narrow by time.[14][4]
  • Unread or starred first: In Settings, under Inbox type, pick Unread first or Starred first. Gmail then splits the inbox into two sections.[5]

Any of these searches can become a filter as described above. That's the step from viewing mail in order to filing it automatically.

07Cleaning 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.

With conversation view on, Google says a label you apply covers only the existing messages, not new replies.[3] Apply the label again to new replies, or use a filter whose criteria each reply itself matches.[1][3]

08Inbox category tabs

With the Default inbox type, Gmail files mail into five categories on its own: Primary for people you know and anything that doesn't fit another tab, 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 in Quick settings, 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. The only way to turn tabs off is to switch to another inbox type.[2]

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 sends a sender's email to a category.[2] One side effect: with new-mail notifications on, you only get notified for Primary. Flight, hotel and restaurant confirmations turn up with category:reservations, though you can't add a Reservations tab.[2]

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]

09Gmail's own AI: tabs, smart features and AI Inbox

Categories are Gmail's built-in automatic sorting, and their automatic categorization depends on a privacy setting. Google lists automatic filtering and categorization into Primary, Social and Promotions as an experience of "Smart features in Gmail, Chat, and Meet". Turn that setting off and you lose the listed experiences, including Smart Compose, Smart Reply and summary cards above emails.[12] The checkbox is under Settings → See all settings → General → Smart features.[12]

AI Inbox is a different thing. Google describes it as a separate view with suggested to-dos and topics to catch up on; that help page doesn't describe automatic moves of email. According to Google it only draws on messages in the Primary tab, filters out spam and email you archive, delete, mute or snooze, and doesn't support attachments, delegated inboxes or encrypted email.[11] It's in beta and available only in the US and in English. Personal accounts need Google AI Plus, Pro or Ultra, work accounts an eligible Workspace plan, and both Smart features in Google Workspace and Smart features in other Google products must be on. The first to-dos and topics can take up to seven days to appear.[11] Mark all as read in AI Inbox also marks the affected emails as read in your inbox.[11]

So if you want to turn off Gmail's AI sorting, you can turn off three different things: the AI Inbox view with Show AI Inbox under See all settings → Inbox, categories by choosing another inbox type, or the features listed above with "Smart features in Gmail, Chat, and Meet". That last switch leaves the two settings for Google Workspace and other Google products unchanged; some separately controlled smart features also remain available.[11][2][12] Turn off Gmail AI Inbox explains what each switch costs.

10Check 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.

11Troubleshooting

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, click Edit, add an exclusion with -, then click Continue and Update filter.[1][4]

The category tabs are missing or stopped sorting. If the tabs are missing, check the Default inbox type, the categories selected under Customize and the 250,000-email limit.[2] If automatic categorization is missing, also check smart features in Gmail, Chat, and Meet.[12]

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]

12When 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, write drafts and manage labels and threads. Outside Auto mode, every action Claude takes on your behalf needs your explicit approval by default, while in Auto mode they can run without asking unless an automated check or your organization requires approval, and that check can miss risky actions; on Team and Enterprise, owners decide whether members may let certain actions 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 and that performance may vary for large mailboxes. Setup and limits are in Connect Gmail to Claude.

Google's Gmail MCP server. Google runs its own MCP server. The tool list on Google's setup page includes searching and reading, creating labels and filters, adding and removing labels, moving messages to spam or trash, drafts, and sending, replying and forwarding; it contains no tool for permanent deletion. Before sensitive actions such as sending, the server by default requests approval in the client through MCP form elicitation; persistent user approvals or administrator rules can remove that prompt[16]. You need a Google Cloud project and an MCP host. Running the command-line examples on Google's page also requires the gcloud CLI.[8] So setup requires your own Cloud project and configuration of an MCP client; 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.[9]

According to the app code, a Command Mail rule targets exactly one sender address or one sender domain including its subdomains, 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, confirmations and notifications. Domains that many unrelated people send from, such as gmail.com, outlook.com or yahoo.com, can't be a rule target; there you set a rule for one exact address.

The app code protects mail that Command Mail recognizes as a security notice, payment problem, invoice, deadline, appointment, request for action or personal message, plus cases such as threads you've replied in. When a spam or trash rule matches such an email, the match becomes a suggestion for you to decide. Archive and folder rules may only file the protected type they explicitly name, for example a rule that files one shop's invoices into a Finance folder. For disguised phishing identified with certainty, the code removes the security, payment-problem, invoice, deadline and action-request protections; other protections may remain, and mere suspicion of phishing removes no protection. This protection applies to rule decisions and the classifier's spam decision. It is not a general block on direct agent actions on Limited filing. For an archive or folder rule that explicitly names a protected type, neither that type nor the safe-sender protection (safe_sender) blocks filing. If other protections remain, such as an additional deadline or a thread you have replied in, the match still becomes a suggestion.

How much the agent may do on its own is set per mailbox under Automation & rules, with four levels: Read only, Suggest, Confirmed rules and Limited filing.[10] On Suggest, an agent's archiving, moves to Spam or Trash, category changes and filing into folders become suggestions; newly created agent rules are also saved as suggestions. There, your own rules, such as those from spam clicks, already apply, and if you switch on a rule the agent proposed, it counts as yours. On Confirmed rules, enabled rules act on new mail automatically, including the agent's rules; the app code also allows the agent to activate rules there. The direct filing and category changes listed above remain suggestions. Only Limited filing lets the agent archive or mark spam directly, journaled, undoable and at most 50 conversations per step.[10] Per the app code, the agent changes labels, read status and stars immediately on any level above Read only. A new mailbox starts on Suggest, or on Read only if the Catch-all row is set to Read only; mailboxes connected earlier keep their level. So check each mailbox before the agent's first run.

The free plan covers one mailbox with the last 90 days, reading, search, sorting, the morning brief and drafts, without sending; further mailboxes pause and keep receiving.[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.

13Connect Command Mail to your agent

Your agent connects to the hosted MCP server at https://commandmail.app/mcp and signs in with OAuth. ChatGPT has an official plugin in its plugin directory, though installing and using plugins depends on plan, workspace, role and region; Claude lists Command Mail as a community connector in its directory, and Claude Code connects with claude mcp add --transport http commandmail https://commandmail.app/mcp.[9]

You pick the permissions on the consent page. Sorting needs only mail:read, which covers reading, search and sorting within each mailbox's level but applies to every mailbox in your account. Drafts need mail:draft; sending on its own needs the separate mail:send permission and a mailbox on Limited filing.[10] Per the app code, only a person signed in through the browser can approve drafts or change a mailbox's level. An agent can switch on its own rules only in mailboxes on Confirmed rules or Limited filing; elsewhere its rule stays a suggestion.

14What changed on this page

Revised on 2026-11-11. New: sections on sorting by sender, size and date, on Gmail's smart features and AI Inbox, the "category tabs are gone" fix, the note on labels in conversation view, and the section on connecting your agent.[3][11][12][13][14][15] We made the Command Mail protection statement more precise. The earlier version said no rule sends invoices, deadlines or security notices to spam or trash; per the app code, such a match becomes a suggestion; for disguised phishing identified with certainty, the code removes the security, payment-problem, invoice, deadline and action-request protections, and other protections may remain. The protection described applies to rule decisions and the classifier's spam decision, not generally to its category or label assignments and not to direct agent actions on Limited filing. We corrected the source reference for autonomy statements. For enabling rules, this guide follows the app code: on Confirmed rules and Limited filing, agents may activate rules themselves. The retrieved public documentation still describes this differently. For Google's MCP server, we now name the gcloud CLI only for the command examples shown. Claude's approval behavior now follows Anthropic's wording, and the autonomy levels carry their names in the app. Google's inbox layout help has moved to a new address.

15Next 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. For automatic invoice filing and forwarding to accounting software, see Automatically file invoices from email.

Start Command Mail for free, forward your Gmail address and connect your agent so it can suggest your first rules.

16Sources and date

Last checked: 2026-11-11. The Google and Anthropic help pages, Google's MCP reference and Command Mail's public pages were retrieved that day; Google's help pages through the r.jina.ai reader and as raw HTML, Claude's help as raw HTML. Statements about Command Mail rules, protected types, labels and starting levels also rest on the app code at commit 60c8c3d (mail-rules.ts, classify-policy.ts, mail-signals.ts, mcp.ts, intake.ts, domains.ts, interface strings in messages/en.json). 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 choose to apply a label. Also choose to archive it if the email shouldn't show up in your inbox.

Can I sort Gmail by sender or by size?

Google's guide for people switching from Outlook doesn't describe a sort menu for Gmail. It points to inbox types, newest or oldest first, and search instead. Use from: to find email from one sender (add in:anywhere to include Spam and Trash) and larger:10M for big emails. Under More → Manage subscriptions, Gmail also lists senders with active subscriptions and how many emails each sent recently, if the feature has reached your account.

Can I create my own category tabs?

No. Google says you can only choose from the existing categories Primary, Social, Promotions, Updates and Forums. Use labels for your own groups, and the Multiple inboxes layout if you want labels shown as sections of your inbox.

Why did my Gmail category tabs disappear?

If the tabs are missing, check that Inbox type is still set to Default, which categories are ticked under Customize, and whether your inbox contains more than 250,000 emails. If Gmail stopped categorizing automatically, also check that Turn on smart features in Gmail, Chat, and Meet is still checked under See all settings → General. Google lists automatic filtering and categorization into Primary, Social and Promotions as part of that setting.

Does a new filter apply to emails I already have?

For forwarding filters Google says explicitly that only new messages are affected. Google's filter help doesn't say whether other filters reach existing mail. The safest way to handle older mail is to run the same search, select the results and apply the label from the Labels button yourself.

Can an AI agent sort my Gmail for me?

Claude's Google Workspace connector can manage labels and threads, according to Anthropic. Outside Auto mode, every action Claude takes on your behalf needs your explicit approval by default; in Auto mode, actions can run without asking unless an automated check or your organization requires approval, though that check can miss risky actions, and on Team and Enterprise plans owners can let members run certain actions without asking. 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: Refine searches in Gmail (search operators) 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 developers.google.com, accessed
  9. Command Mail: plans and agent routes commandmail.app, accessed
  10. Command Mail: documentation (permissions and autonomy) commandmail.app, accessed
  11. Google: Manage to-dos & topics with AI Inbox support.google.com, accessed
  12. Google: Learn about smart features & controls for Google Workspace & other Google products support.google.com, accessed
  13. Google: Switch from Outlook to Gmail, view and find email support.google.com, accessed
  14. Google: Search in Gmail support.google.com, accessed
  15. Google: Manage your subscriptions in Gmail support.google.com, accessed
  16. Google: Handle user approvals with form elicitation developers.google.com, accessed
EN