New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
Getting startedUpdated 4 Nov 2026

Gmail Search Operators: Advanced Search and Filters Cheat Sheet

A practical cheat sheet of Gmail search operators with working examples: sender, date, size, attachment, label and category searches, how to combine them, and how to turn a search into a filter.

AM
Written by Aarav Mehta
Head of Deliverability
Reviewed by Sana Qureshi
  • Published27 Jan 2024
  • Read time7 min
  • Length1,403 words
Share this guide

Gmail search operators are short keywords you type into the search box, such as from:, has:attachment or older_than:1y, that narrow results far more precisely than plain words. Type the operator, a colon and the value with no space after the colon, and combine as many as you need. A search like from:[email protected] has:attachment after:2024/01/01 finds every message with an attachment from that sender since the first of January 2024.

This cheat sheet lists the operators that matter day to day, shows how to combine them with AND, OR and negation, and explains how to turn any search into a filter that labels or archives mail automatically. Google adds and adjusts operators from time to time, so if one does not behave as described, check the current Gmail Help pages for search operators.

Syntaxoperator:value, no space after the colon; spaces between terms mean AND
Exact phraseWrap words in double quotes: "quarterly report"
ExcludePrefix a term or operator with a minus sign: -label:newsletters
Save a searchUse Create filter from the search options to act on matching mail automatically

Gmail treats every space between terms as an implicit AND. Searching for invoice march returns messages containing both words anywhere in the message, in any order. Searches are not case sensitive, and Gmail also matches some word variations, so results can include related forms of a word. Use quotes when you need the exact phrase in the exact order.

Searches look at the default scope of your mailbox, which normally excludes Spam and Trash. Add in:anywhere when you suspect the message was deleted or filtered into spam.

Sender, recipient and subject operators

OperatorWhat it doesExample
from:Messages sent by a person or domainfrom:@example.com
to:Messages addressed to a recipientto:[email protected]
cc: and bcc:Messages where the address was in Cc or Bcc (bcc only works on mail you sent)cc:[email protected]
subject:Words in the subject linesubject:(purchase order)
deliveredto:The address the message was delivered to, useful for aliasesdeliveredto:[email protected]
list:Messages sent through a mailing listlist:[email protected]

Group several words with parentheses so the operator applies to all of them: subject:(order confirmation) requires both words in the subject, while subject:order confirmation requires only order in the subject and confirmation anywhere.

Date and age operators

Dates use the year/month/day format. Gmail also supports relative age, which is the easiest way to find old mail to clean up.

OperatorMeaningExample
after:Sent after the dateafter:2024/01/01
before:Sent before the datebefore:2024/06/30
older_than:Older than a period; d, m or yolder_than:2y
newer_than:Newer than a periodnewer_than:7d
after:2024/01/01 before:2024/02/01 from:[email protected]
older_than:1y category:promotions
newer_than:3d is:unread -category:promotions

Attachment and size operators

OperatorMeaningExample
has:attachmentHas any attachmentfrom:[email protected] has:attachment
filename:Attachment name or typefilename:pdf or filename:report.xlsx
larger:Bigger than a size (use M or K, or plain bytes)larger:10M
smaller:Smaller than a sizesmaller:100K
size:Approximately this size or more in bytessize:5000000
has:drive, has:document, has:spreadsheet, has:presentationLinks to or attachments of those kindshas:spreadsheet from:[email protected]

To free storage, a useful pattern is has:attachment larger:10M, then sort through the results and delete what you no longer need. For the storage side of this, see freeing up Gmail storage. Remember that deleted mail stays in Trash until it is emptied, so empty Trash to reclaim the space.

Labels, status and location operators

OperatorMeaning
label:Mail with a label; replace spaces in the label name with hyphens, for example label:project-alpha
has:nouserlabelsMail with none of your own labels, handy for finding unsorted mail
in:inbox, in:sent, in:drafts, in:spam, in:trash, in:anywhereRestrict to a system location, or search all of them with in:anywhere
is:unread, is:readRead state
is:starred, is:importantStarred or marked important
is:snoozedCurrently snoozed messages
category:Tab category such as primary, social, promotions, updates, forums
rfc822msgid:Find one message by its Message-ID header value

The rfc822msgid: operator is the one engineers reach for when debugging delivery. If you have a Message-ID from a log, paste it after the operator to locate the exact message in a mailbox. For how that identifier is built, see the Message-ID header.

Combining operators: AND, OR, minus, braces and AROUND

  • AND: implicit. from:alice subject:budget needs both.
  • OR: must be uppercase. from:alice OR from:bob.
  • Braces: shorthand for OR. {from:alice from:bob} equals the line above.
  • Minus: excludes. from:example.com -from:[email protected].
  • Parentheses: group terms. subject:(invoice OR receipt) has:attachment.
  • Quotes: exact phrase. "password reset".
  • AROUND: words near each other. holiday AROUND 10 vacation matches the two words within ten words of each other.
{from:[email protected] from:[email protected]} after:2024/03/01 -label:archive
subject:(invoice OR receipt) has:attachment older_than:6m
in:anywhere "unsubscribe" -in:trash larger:1M

Ready-made searches for common jobs

GoalSearch
Find big mail to deletelarger:15M
Old newsletterscategory:promotions older_than:1y
Everything from one companyfrom:@example.com
Receipts this yearsubject:(receipt OR invoice) after:2024/01/01
Unsorted mail in the inboxin:inbox has:nouserlabels
Unread mail from people you staris:unread from:me OR is:starred (test the grouping before bulk actions)
Mail that went to spamin:spam from:example.com

Turn a search into a filter

Once a search returns exactly the right set, you can save the logic as a filter so future mail is handled automatically. This is the bridge between searching and inbox automation, which is covered in depth in Gmail filters and labels.

  1. Click the search options icon at the right edge of the search box, or type your operators directly and press Enter.
  2. Check the results to confirm that they are what you expect.
  3. Open the search options again and choose Create filter. The fields mirror the operators: From, To, Subject, Has the words, Doesn't have, Size and Has attachment.
  4. Choose what to do: apply a label, skip the inbox, mark as read, star, forward, delete or never send to spam. Optionally apply the filter to existing conversations.
  5. Save it. Manage or delete filters later from Settings, See all settings, Filters and Blocked Addresses. Menu wording can change, so confirm in Gmail Help if it looks different.

Be careful with the delete action. Test with a label first, review what lands in it for a few days, and only then switch to deleting.

Habits that make searching faster

Start broad and narrow in steps. Type from: first, look at the results, then add after: or has:attachment until the list is short enough to scan. Adding operators one at a time also makes it obvious which one removed the message you wanted.

Use consistent labels. Searches such as label:clients-acme are only as good as your labelling, so choose a naming scheme early and stick to it. Use deliveredto: with plus addressing or aliases to separate mail by the address you gave out, which makes it easy to see which service shared your address. See plus addressing for how that works.

Finally, treat bulk actions with care. After a search, Gmail offers to select every conversation matching it, not only the ones on screen. Read the count before you delete or archive, and prefer applying a label first so that you can undo the change.

Troubleshooting searches

ProblemLikely causeFix
No results for something you know existsMessage is in Spam or Trash, or the operator has a space after the colonAdd in:anywhere and remove spaces after colons
Too many resultsTerms are matched anywhere in the bodyAdd subject: or from:, or exact quotes
OR seems ignoredLowercase or in the wrong placeUse uppercase OR, or braces
Label search failsLabel name has spacesReplace spaces with hyphens
Date search off by a dayTime zone boundariesWiden the range by a day
Search works on web but not on phoneApp has reduced operator support or is still syncingUse the web interface for complex searches

When to use search and when to use something else

Search is the right tool for finding and one-off cleanup. If you find yourself repeating the same search every week, make it a filter. If you are searching an inbox to trace what happened to a message you sent from an application, mailbox search shows only the receiving end. Delivery logs and bounce messages explain more, so see tracing message events and reading email headers.

Sending mail from your own application? Get delivery, bounce and complaint events you can search and act on.

See the SMTP relay

References and further reading

Frequently asked questions

How do I search Gmail by date?

Use after:YYYY/MM/DD and before:YYYY/MM/DD, or relative age with older_than:1y and newer_than:7d.

How do I find emails with large attachments?

Search has:attachment larger:10M, adjusting the size, then delete the messages you no longer need and empty Trash.

Does Gmail search include Spam and Trash?

Not by default. Add in:anywhere to search every location, or in:spam and in:trash for one of them.

How do I search for two senders at once?

Use OR in uppercase or braces: from:alice OR from:bob, or {from:alice from:bob}.

Can I save a search?

Gmail has no saved searches as such, but you can create a filter from the search options to act on matching mail automatically.

Topics#gmail#search#operators#filters#inbox management
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales