Skip to main content

CMDK for Gmail

🚨 Simplehuman is now CMDK   |   New name. Same mission.  Read More.

Gmail Search Operators: The Cheat Sheet and a Builder That Writes the Query for You

Gmail’s search bar accepts a query language that most people never use. from:stripe has:attachment after:2026/01/01 finds the invoice in two seconds; scrolling finds it in ten minutes. The operators are not hard, there are just more of them than anyone remembers.

Install CMDK for Gmail, free

This page has both fixes: a builder that writes the query from a form, and the cheat sheet for when you want to type it yourself.

Build your search

Fill in what you know, copy the query, or run it in Gmail directly.

Fill in a field above to build your search
Run in Gmail Copied to clipboard
Paste into Gmail’s search bar, or hit Run in Gmail to open the search directly. Runs entirely in your browser; nothing you type here is sent anywhere.

The operators worth memorizing

These eight cover almost every real search:

  • from: and to: match sender and recipient. A name fragment works: from:amazon catches every Amazon address.
  • subject: matches the subject line only.
  • after: and before: take dates as YYYY/MM/DD.
  • older_than: and newer_than: take relative periods: older_than:1y, newer_than:2d. Units are d, m, and y.
  • has:attachment limits results to emails with files attached.
  • larger: and smaller: filter by size: larger:10M finds the storage hogs.
  • is: filters by state: is:unread, is:starred, is:important.
  • in: and category: pick the location: in:spam, in:sent, category:promotions.

Combining operators

Operators separated by spaces are ANDed together, so from:stripe has:attachment means both conditions. Four more combinators cover the rest:

  • OR (capitals required) matches either side: from:stripe OR from:paypal
  • The minus sign excludes: dinner -movie finds emails with “dinner” but not “movie”
  • Curly braces are an alternative OR: {from:stripe from:paypal}
  • Parentheses group words for one operator: subject:(quarterly report) requires both words in the subject

Exact phrases go in quotes: "out for delivery" matches those words in that order.

Complete Gmail search operators reference (2026)

Every operator Gmail’s search bar accepts, grouped by what it filters. Combine any of them with a space to narrow further.

OperatorWhat it findsExample
People and addresses
from:Messages from a senderfrom:amazon
to:Messages sent to someoneto:me
cc: / bcc:Someone on the Cc or Bcc linecc:[email protected]
deliveredto:Mail delivered to a specific address (aliases)deliveredto:[email protected]
list:Mail from a mailing listlist:[email protected]
Words and subject
subject:Words in the subject line onlysubject:invoice
" "An exact phrase, in order"quarterly report"
+An exact word, no synonyms+unicorn
AROUNDTwo words within N words of each otherbudget AROUND 5 approval
Attachments and files
has:attachmentAny attached filefrom:me has:attachment
filename:An attachment by name or typefilename:pdf
has:drive / document / spreadsheet / presentationA linked Google Drive file, Doc, Sheet or Slideshas:spreadsheet
has:youtubeA YouTube video linkhas:youtube
Status and labels
is:State: unread, read, starred, snoozed, important, mutedis:unread
label:A specific labellabel:receipts
has:userlabels / nouserlabelsMail with, or without, any labelhas:nouserlabels
has:yellow-star, has:red-bang…A specific star or markerhas:yellow-star
Location
in:inbox, sent, draft, spam, trash, anywherein:anywhere
category:A tab: primary, social, promotions, updates, forumscategory:promotions
Date and size
after: / before:Absolute dates, YYYY/MM/DDafter:2026/01/01
older_than: / newer_than:Relative age in d, m, ynewer_than:7d
larger: / smaller:Size, with M or Klarger:10M
Logic
OR or { }Match either side (OR must be capitals){from:stripe from:paypal}
-Exclude a word or operatordinner -movie
( )Group terms for one operatorsubject:(quarterly report)

Searching by date

Two ways, depending on what you know:

  • Absolute dates use after: and before: with YYYY/MM/DD: after:2026/01/01 before:2026/02/01 is January 2026.
  • Relative periods use older_than: and newer_than:: newer_than:7d is the last week, older_than:1y is everything before last July.

The relative forms are what make cleanup searches reusable: category:promotions older_than:6m means “old promotions” forever, no date math required.

Searches worth saving

  • larger:10M older_than:1y finds old large emails, the fastest storage win
  • has:attachment filename:pdf from:me finds every PDF you have sent
  • is:unread older_than:1m in:inbox finds the unread pile you are never going to read
  • from:noreply older_than:6m finds stale automated mail, safe to delete wholesale
  • to:me -in:chats is:unread newer_than:2d finds what actually needs attention today

The cleanup searches feed directly into bulk actions; our guide to mass deleting emails in Gmail covers the select-all-and-delete step.

Any search you build with these operators can also run automatically. Our guide to Gmail filters and rules shows how to turn an operator string into a rule that labels, archives, or deletes matching mail the moment it arrives.

Frequently asked questions

How do I search Gmail by date range?

Use after: and before: with dates in YYYY/MM/DD format, for example after:2026/01/01 before:2026/02/01 for January 2026. For relative ranges, use newer_than: and older_than: with d, m, or y units, like newer_than:7d for the past week.

How do I search Gmail for emails with attachments?

Use has:attachment, and narrow by type with filename:, for example has:attachment filename:pdf. To find large attachments, add a size filter like larger:5M.

Can I search Gmail for exact phrases?

Yes. Put the phrase in double quotes: “quarterly board review” matches those words in that order. Without quotes, Gmail matches emails containing all the words anywhere.

How do I exclude words from a Gmail search?

Put a minus sign directly before the word or operator: dinner -movie, or from:amazon -subject:(order confirmation). The minus works on any operator, not just words.

Does Gmail search look inside attachments?

Yes, for common formats. Gmail indexes the text of PDFs and Office documents, so searching a phrase can match an email where the phrase only appears in the attached file.

One more shortcut: press / and Gmail focuses the search bar, no mouse needed. CMDK takes the same idea further with a Cmd+K command bar that searches, archives, snoozes, and labels from the keyboard.

Related: how to find unread emails in Gmail with is:unread.

CMDK logo

Supercharge your Gmail

Install the extension in seconds to get to inbox zero faster

More from the Blog

gmail reminder

How to Set Reminders in Gmail (3 Ways That Actually Work)

bulk unsubscribe gmail

How to Unsubscribe From Emails in Gmail (Bulk, the Easy Way)

be faster in gmail with Simplehuman

Gmail Archive Shortcut: One Key to Archive Emails (E)

How to bulk delete emails in Gmail: select all conversations that match this search

How to Bulk Delete Emails in Gmail (All at Once, Not 50 at a Time)

be faster in gmail with Simplehuman

Inbox Zero in Gmail: What It Really Means and How to Achieve It

Other apps vs Gmail

Which email client has better keyboard shortcuts: Superhuman or others?

Supercharge your Gmail

Simplehuman Logo Install CMDK

CMDK works on the desktop browser.Enter your email below, and we will send you a link to install CMDK when you are on your computer.