Guide · Updated October 29, 2026
Gmail filter operators: date, wildcard, subject, size and more
Gmail filters understand the same operators as the search box: from:,
to:, subject:, OR and curly braces, quotes for a
phrase, a minus sign to exclude, has:attachment, larger:,
older_than: and the rest. Type them into “Has the words” and the filter matches
exactly what the search would. This page is the reference: every operator with an example,
how OR works, how to filter by date and why that rarely works as an automatic filter, what
to use instead of a wildcard, and “subject contains” done properly. It goes deeper on one
part of our
Gmail filters guide.
Read-only, about a minute. Nothing in your mailbox changes.
Where operators go in a Gmail filter
Gmail filter operators are typed into the “Has the words” field of the search options (the
sliders icon at the right end of the search box), and the same operators work in the search
box itself. The From, To and Subject fields each take one kind of condition; “Has the words”
takes any combination, so from:example.com subject:invoice has:attachment is one
filter that needs all three. Type the conditions, click “Search” to see what they catch, then
“Create filter” to choose the actions.
The form fields are shortcuts for a few of these operators: the From field is
from:, “Doesn’t have” is the minus sign, “Has attachment” is
has:attachment, and the size row with its “greater than” dropdown is
larger:. Writing the operator in “Has the words” instead gives you the same match
with brackets and OR available, which the fields don’t offer.
Every Gmail filter operator
| Operator | Matches |
|---|---|
from:anna@example.com |
The sender. from:example.com matches everyone at that domain. |
to:me, cc:, bcc: |
Who the email was addressed or copied to. bcc: only matches mail you
sent.
|
subject:invoice |
A whole word in the subject line. Quotes for a phrase. |
a OR b, {a b} |
Either one. OR must be capitals; the braces mean the same. |
-unsubscribe |
Exclude. Works in front of any operator: -from:boss@example.com. |
"payment due" |
The exact phrase, words in that order. |
from:(a OR b) subject:(x OR y) |
Grouping. Brackets keep an OR inside one operator. |
has:attachment |
Any attachment. filename:pdf or filename:report.xlsx narrows
it.
|
larger:5M, smaller:500K |
Total size of the email including attachments, in K or M. |
older_than:1y, newer_than:7d |
Relative age, in d, m or y. |
before:2025/01/01, after:2024/06/30 |
Fixed dates, written YYYY/MM/DD. |
list:news.example.com |
Mail sent through a mailing list, whatever the From address. |
is:unread, is:starred, is:important
|
State. Useful in search; in a filter, new mail is always unread and never yet starred. |
in:anywhere |
Include Spam and the bin, which search and filters normally skip. |
has:userlabels, has:nouserlabels |
Mail with, or without, any label you made yourself. |
category:promotions |
Gmail’s tab: primary, social, promotions, updates or forums. |
deliveredto:alias@example.com |
The address it was actually delivered to, which catches aliases and group mail. |
contract AROUND 5 signed |
Two words within a few words of each other. Capitals, number is the distance. |
Two rules apply to all of them. Gmail matches whole words, so invoice doesn’t
match “invoices”, and everything in one filter is an AND unless you write OR
yourself.
How to use OR in a Gmail filter
To make a Gmail filter match one condition or another, write OR in capitals
between them: from:a@example.com OR from:b@example.org. Curly braces mean the
same thing with less typing, {from:a@example.com from:b@example.org}, with a
space between the items. Either form works in “Has the words”, in the From, To and Subject
fields, and in the search box, so you can test it before you save the filter.
Where it does not work: lowercase or is searched for as a word, a comma is not a
separator, and OR never reaches across fields. Each field of the filter form is an AND with
the others, so a sender in From and a word in Subject must both match. To say “this sender or
that word”, put the whole condition in “Has the words” instead:
from:a@example.com OR subject:invoice. Brackets keep an OR inside one operator,
from:(a@example.com OR b@example.org) has:attachment, which reads “from either
address, and has an attachment”. There is no AND keyword; a space already means
it. The
multiple senders guide
has longer OR lists and the mistakes that break them.
How to filter Gmail by date
To filter Gmail by date, use before: and after: with a date written
YYYY/MM/DD, or older_than: and newer_than: with a
number and d, m or y.
after:2025/01/01 before:2025/02/01 is January 2025; older_than:1y is
everything more than a year old today. Both forms work in the search box and in “Has the
words”.
Date operators make poor automatic filters, and it is worth understanding why before you save
one. A filter runs once, when an email arrives. At that moment the email is zero days old and
dated today, so before:2025/01/01 never matches new mail, and
older_than:30d never matches either, because nothing arriving is 30 days old.
Gmail will accept the filter; it just never fires.
Date operators are for one-off clean-ups. Create the filter with the date condition, tick “Also apply filter to matching conversations”, and Gmail applies the actions once to everything that matches today; our existing emails guide walks through that. Then delete the filter, because it will not do anything else. If you want “archive mail from this sender once it is a month old” to happen on its own, Gmail has no setting for it; give the sender a filter with “Skip the Inbox” instead so there is never a backlog.
Gmail filter wildcards
Gmail filters do not support wildcards. *@example.com, invoice* and
subject:report-* are not understood, and partial-word matching doesn’t work
either, so subject:invoic matches nothing. Three things cover what people usually
reach for a wildcard to do:
-
Any address at a domain.
from:example.comdoes what*@example.comwould. It also matches subdomains such asmail.example.com. -
Several variants of a word. List them:
{invoice invoices invoicing}, orsubject:(invoice OR invoices). -
A pattern in the subject. Use the fixed part as a phrase:
subject:"Weekly report"matches “Weekly report – 14 Oct” and “Weekly report (final)” because Gmail ignores punctuation around words.
If your sender list changes faster than you can edit it, see
one filter for multiple senders
for list: and domain matching.
Filter by subject contains
To filter by “subject contains”, type the word in the Subject field, or
subject: and the word in “Has the words”. The Subject field and the
subject: operator both match whole words anywhere in the subject line, in any
order. subject:order confirmation matches a subject with both words, even far
apart. For the words in that order, use quotes: subject:"order confirmation". For
either of two words, group them: subject:(receipt OR invoice). Capitalisation
never matters.
What “contains” can’t do is match part of a word or a reference number pattern.
subject:INV- won’t catch “INV-20491”; Gmail treats the number as one token. Match
a word that always appears alongside it, or the sender, instead.
Filtering by size and attachment
larger:10M finds the emails taking up your storage, and
has:attachment larger:10M older_than:1y is the usual clean-up search: big, old,
with a file. Run it as a search, select all matching conversations and delete or archive by
hand, or create the filter with “Also apply filter to matching conversations” for the one-time
pass. Gmail measures the whole email, so a 4 MB PDF in a message with inline images may show
as 6 MB. filename: takes a file type (filename:pdf) or a name
(filename:"statement.pdf"), and has:attachment on its own is the
sensible condition for a standing filter that labels anything with a file from a given sender.
Test the filter as a search first
- Type the operators into the search box and press Enter. The results are exactly what the filter would match.
- Look for false matches in the first page. A filter that archives needs a clean result list; a filter that only labels can afford a few.
- Widen or narrow, then click the sliders icon: the search options open with your query already in “Has the words”, and “Create filter” is one click away.
For mail that has to be read
Operators match words and headers, which is exactly right for a known sender or a subject line that never changes. They can’t tell that an email from a shop you have never used is a receipt, that “payment due” and “amount outstanding” are both invoices, or that a thread is waiting on you. For that, Syfft reads each new email and adds one of its labels within about a minute, leaves unclear mail alone, moves nothing unless you turn Skip the inbox on for a label, and logs every label on the dashboard where it can be undone. The filters you write with these operators keep running alongside it.
Related guides
Questions about Gmail filter operators.
See all questionsWhy doesn’t my filter with older_than: do anything?
A filter runs when an email arrives, and a new email is zero days old, so
older_than: and before: never match it. Use date operators with
“Also apply filter to matching conversations” for a one-time pass, then delete the filter.
Can I use * as a wildcard in a Gmail filter?
No. Gmail ignores it. Match a domain with from:example.com, list word variants
with OR or braces, or use a fixed phrase in quotes.
Does subject: match part of a word?
No. Gmail matches whole words, so subject:invoice misses “invoices”. List the
forms you expect: subject:(invoice OR invoices).
How do I find emails with large attachments?
Search has:attachment larger:10M, adding older_than:1y to keep
recent mail out of it. Gmail counts the whole email, attachments included.
Do these operators work in the Gmail app?
In the app’s search box, yes. Creating or editing a filter needs Gmail on the web; once made there, the filter runs on the server for every device.
See what Syfft finds in your inbox.
Connect Gmail or Outlook and see the labels on your 50 most recent emails. Read-only, and it takes about a minute.