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.
How Gmail interprets a search
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
| Operator | What it does | Example |
|---|---|---|
from: | Messages sent by a person or domain | from:@example.com |
to: | Messages addressed to a recipient | to:[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 line | subject:(purchase order) |
deliveredto: | The address the message was delivered to, useful for aliases | deliveredto:[email protected] |
list: | Messages sent through a mailing list | list:[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.
| Operator | Meaning | Example |
|---|---|---|
after: | Sent after the date | after:2024/01/01 |
before: | Sent before the date | before:2024/06/30 |
older_than: | Older than a period; d, m or y | older_than:2y |
newer_than: | Newer than a period | newer_than:7d |
after:2024/01/01 before:2024/02/01 from:[email protected]
older_than:1y category:promotions
newer_than:3d is:unread -category:promotionsAttachment and size operators
| Operator | Meaning | Example |
|---|---|---|
has:attachment | Has any attachment | from:[email protected] has:attachment |
filename: | Attachment name or type | filename:pdf or filename:report.xlsx |
larger: | Bigger than a size (use M or K, or plain bytes) | larger:10M |
smaller: | Smaller than a size | smaller:100K |
size: | Approximately this size or more in bytes | size:5000000 |
has:drive, has:document, has:spreadsheet, has:presentation | Links to or attachments of those kinds | has: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
| Operator | Meaning |
|---|---|
label: | Mail with a label; replace spaces in the label name with hyphens, for example label:project-alpha |
has:nouserlabels | Mail with none of your own labels, handy for finding unsorted mail |
in:inbox, in:sent, in:drafts, in:spam, in:trash, in:anywhere | Restrict to a system location, or search all of them with in:anywhere |
is:unread, is:read | Read state |
is:starred, is:important | Starred or marked important |
is:snoozed | Currently 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:budgetneeds 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 vacationmatches 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:1MReady-made searches for common jobs
| Goal | Search |
|---|---|
| Find big mail to delete | larger:15M |
| Old newsletters | category:promotions older_than:1y |
| Everything from one company | from:@example.com |
| Receipts this year | subject:(receipt OR invoice) after:2024/01/01 |
| Unsorted mail in the inbox | in:inbox has:nouserlabels |
| Unread mail from people you star | is:unread from:me OR is:starred (test the grouping before bulk actions) |
| Mail that went to spam | in: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.
- Click the search options icon at the right edge of the search box, or type your operators directly and press Enter.
- Check the results to confirm that they are what you expect.
- 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.
- 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.
- 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
| Problem | Likely cause | Fix |
|---|---|---|
| No results for something you know exists | Message is in Spam or Trash, or the operator has a space after the colon | Add in:anywhere and remove spaces after colons |
| Too many results | Terms are matched anywhere in the body | Add subject: or from:, or exact quotes |
OR seems ignored | Lowercase or in the wrong place | Use uppercase OR, or braces |
| Label search fails | Label name has spaces | Replace spaces with hyphens |
| Date search off by a day | Time zone boundaries | Widen the range by a day |
| Search works on web but not on phone | App has reduced operator support or is still syncing | Use 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.
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.