Gmail Filters

Gmail search operators, each with a working example

26 September 2026 · 2 min read

Gmail's search box understands a small query language, and almost nobody uses more than from: and subject: of it. The rest is what turns "find that one email" into a search that returns exactly one message, and it is also, operator for operator, the language Gmail filters are written in — a filter is a saved search with an action attached. Learn to search well and you already know how to write a filter.

Every operator below is typed straight into the Gmail search box, and most combine with a space between them, which Gmail treats as AND. Type from:amazon.com has:attachment and you get mail from Amazon that has an attachment, not either condition on its own.

Who sent it or received it

OperatorMatchesExample
from:Mail from a specific address or domainfrom:billing@vendor.com
to:Mail sent to a specific addressto:you@gmail.com
cc:Mail where the address is copiedcc:manager@work.com
bcc:Mail you blind-copied — only reliable for mail you sentbcc:list@company.com
deliveredto:The address mail was actually delivered to — useful behind an alias or forwarddeliveredto:alias@yourdomain.com

The domain trick worth knowing: Gmail has no wildcard character. A * does not mean "anything": from:(bill*@vendor.com) finds nothing, not even billing@vendor.com. To match every address at a domain, write the domain on its own: from:(@vendor.com) matches billing@vendor.com, support@vendor.com, all of it, with no asterisk needed.

What it says

OperatorMatchesExample
subject:Words in the subject linesubject:invoice
"exact phrase"An exact phrase, anywhere in the message"quarterly report"
-wordExcludes messages containing a worddinner -restaurant
word1 OR word2Either term — write out OR, lowercase or does not workfrom:amy OR from:bob

Attachments and embedded content

OperatorMatchesExample
has:attachmentAny file attached to the messagehas:attachment
filename:A specific file name or extensionfilename:pdf
has:driveA linked Google Drive filehas:drive
has:document / has:spreadsheet / has:presentationA linked Doc, Sheet, or Slides filehas:spreadsheet
has:youtubeA linked YouTube videohas:youtube

Where it lives

OperatorMatchesExample
in:anywhereEvery message, including Spam and Trashin:anywhere invoice
in:inbox / in:trash / in:spam / in:snoozedJust that locationin:trash
label:A specific labellabel:receipts
category:A specific inbox tabcategory:promotions

Status

OperatorMatchesExample
is:unread / is:readRead stateis:unread
is:starredStarred messagesis:starred
is:importantMessages Gmail's own ranking marked importantis:important
is:mutedConversations you mutedis:muted

When it arrived

OperatorMatchesExample
after: / before:On or after / on or before a date, written yyyy/mm/ddafter:2026/01/01
older_than: / newer_than:Relative age — a number plus d, m, or yolder_than:1y

Size

OperatorMatchesExample
larger:Messages above a size — a number plus a unit, K or Mlarger:10M
smaller:Messages below a sizesmaller:1M

Combining operators

Four rules cover every combination above: a space between terms is AND; OR (capitalised) means either; a leading - excludes; and parentheses group terms so a domain or an OR applies to everything inside them rather than just the word next to it. from:(alice@x.com OR bob@x.com) has:attachment -in:trash reads left to right exactly as it looks: from either address, with an attachment, not in Trash.

Why this is worth learning before you write a filter

A Gmail filter's Has the words field takes this syntax — there is no separate, simpler filter language to learn. One caveat: a filter runs as each message arrives, so operators about what happens to mail later (is:, in:, label:, older_than:) are unreliable there. For the rest, you can test a filter before it exists: type the criteria into the search box first, read the results, and only turn it into a filter once the search returns the right mail.

That is also the fastest way to debug one that already exists — paste its criteria back into search and see what actually matches today, rather than what you assume it matches. We built Gmail Filters to skip the copy-paste: describe what you want in plain English, and it writes the operator syntax above, runs it against your real inbox so you see every match before anything is applied, and can apply the result backwards over mail that already arrived.

Stop guessing whether a filter works. Gmail Filters runs your filter against your real inbox and shows you every message it catches before you apply anything — then applies it backwards over the mail your broken filter missed.

Try it free