Wednesday, 27 January 2021 14:32

The ultimate guide to Gmail's advanced search filters

By  [Source: This article was published in By Corbin Davenport]

Find the exact email you've been looking for, or finally reach Inbox Zero

Gmail is one of Google's best products, as it's far more than just a simple service for sending and receiving email. It has dozens of powerful features lurking under the surface to help you manage the onslaught of messages, which can come in handy during this age of increased remote work. With the right know-how, you can tell Gmail to find and sort your messages exactly how you want, potentially saving you many hours of micro-managing your inbox.

In this guide, we'll go over the basics of Gmail search, then cover the more advanced filters. Whether you just want to find specific messages or set up long-term filters to help with overflowing inboxes, you've come to the right place.

The basics

Gmail has a large search bar at the top of the screen, typically used for searching by names or simple phrases. When you start typing something, the first few results appear below the bar, or you can press Enter (or click the search button) to see all available results. Pretty simple.


Gmail's regular text search includes results from an email's subject field, senders, and message contents. That means searching for common words and phrases can sometimes give you too many messages to look through. That's where filters come in — they can trim the results down to more manageable sizes.

You might have noticed the small buttons that appear on search pages. These are called 'chips,' and they can help you filter results without opening the Advanced Search panel or typing your own filters. For example, clicking the 'Has attachment' chip will hide all messages that don't have an attached file.

Simple words and phrases combined with Gmail's chips will usually help you find the exact messages you're looking for. But what if you want to set up permanent filters for a specific search? That's where Gmail's advanced search functionality comes in.

Advanced search

You might have noticed the 'Advanced search' link that appears below the search bar after you search for something — it's also accessible by clicking the downwards-pointing arrow in the search bar. The advanced search is a popup with various fields to help you narrow down results. You can filter messages by the sent date, message size, sender name, subject phrase, and more.

The advanced search popup has two buttons at the bottom. The 'Search' button shows you the results for whatever you type in, but the 'Create filter' button will create a message filter with the options you've entered. Clicking the latter option will take you to a second screen, where you can define exactly what happens to messages that the filter catches.


Once you have everything set to how you want, you can click the 'Create filter' button to activate the filter. By default, filters don't do anything to existing messages, but you can change this by clicking the checkbox for 'Also apply a filter to matching conversations.'

You can access all your saved filters by going to Gmail's settings (click the Settings gear -> 'See all settings') and clicking the tab for 'Filters and Blocked Addresses.' This page also allows you to export filters to an XML file, for importing later into another Gmail account.


Let's go over a few practical examples of Gmail filters. Maybe you're subscribed to a few newsletters, but you don't want them mixed in with regular messages in your inbox. A simple way to do this is by creating a filter with "Unsubscribe" in the "Has the words" field, then setting it to skip the inbox and apply a label (e.g. make a new one called 'Newsletters'). Then you could check your newsletters at any time by clicking the proper label in the Gmail sidebar, instead of seeing them pile up in your inbox.


Sample Gmail filter for organizing newsletters

Alternatively, let's say a certain company keeps emailing you with spam, even though you've tried unsubscribing. Gmail allows you to block addresses, but automated messages sometimes use multiple addresses. You can create a filter with an asterisk (*) in parts of the field, which functions as a wildcard. For example, typing "*" in the From field would match all emails with the domain After you have a search set up, you can set the filter to automatically delete all matching emails.


Gmail's default search fields, combined with the filter options on the second screen, should be enough for most use cases. However, if you need layered searches (e.g. do this OR that if X is true) or a filter option that Gmail doesn't show in the popup, read on.

Multi-step filters and basic operators

You might have noticed that Gmail's search/filter interface adds terms like "from:" or "to:" or "subject:" to the search field. These are called search operators, and they can be combined to trim down your results. Gmail types these for you when you use the search interface, but once you grasp how they work, you can make your own complex searches and filters by typing directly in the search bar.

Let's say you wanted to search for all your delivery emails from Amazon. You could type something like this in the search bar, which would show messages sent from any Amazon address with the word "delivery" in the email somewhere:

from:* "delivery"

However, this might not catch all delivery emails. If your package wasn't delivered, the email might not say "delivery" exactly. Adding additional terms like "package" or "order" could give you better results. This is where Gmail's "OR" operator comes in. Here's an updated example:

from:* ("delivery" OR "package" OR "order")

Now we're using parentheses to add nested logic to the filter. In the above example, two factors have to be true: the email has to be from Amazon, and it must contain either "delivery," "package," or "order." If you wanted to keep going and add more retail stores, you could do something like this:

(* OR * OR * ("delivery" OR "package" OR "order") 

Now we have a search that looks for emails from Amazon, Target, and Walmart with the phrases specified in the second half. If it helps readability, you can also add "AND" to the middle (between the two sets of parentheses), and Gmail will still understand it.

Hidden operators and filters

Gmail has many more operators and filter options than the advanced search popup shows. You can sort by attachments (even by file type), links to Google Drive files or YouTube videos, dates, messages from Google Chat, message size, and much more. Below is the full list of filters from the Gmail support website, as of January 2020.

What you can search bySearch operator & example
Specify the sender from:
Example: from:amy
Specify a recipient to:
Example: to:david
Specify a recipient who received a copy cc: bcc:
Example: cc:david
Words in the subject line subject:
Example: subject:dinner
Messages that match multiple terms OR or { }
Example: from:amy OR from:david
Example: {from:amy from:david}
Remove messages from your results -
Example: dinner -movie
Find messages with words near each other. Use the number to say how many words apart the words can be Add quotes to find messages in which the word you put first stays first. AROUND
Example: holiday AROUND 10 vacation
Example: "secret AROUND 25 birthday"
Messages that have a certain label label:
Example: label:friends
Messages that have an attachment has:attachment
Example: has:attachment
Messages that have a Google Drive, Docs, Sheets, or Slides attachment or link has:drive
Messages that have a YouTube video has:youtube
Messages from a mailing list list:
Example: list:This email address is being protected from spambots. You need JavaScript enabled to view it.
Attachments with a certain name or file type filename:
Example: filename:pdf Example: filename:homework.txt
Search for an exact word or phrase " "
Example: "dinner and movie tonight"
Group multiple search terms together ( )
Example: subject:(dinner movie)
Messages in any folder, including Spam and Trash in:anywhere
Example: in:anywhere movie
Search for messages that are marked as important is:important label:important
Starred, snoozed, unread, or read messages is:starred
Messages that include an icon of a certain color has:yellow-star
Recipients in the cc or bcc field cc: bcc:
Example: cc:david
Note: You can't find messages that you received on bcc.
Search for messages sent during a certain time period after: before: older: newer:
Example: after:2004/04/16
Example: after:04/16/2004
Search for messages older or newer than a time period using d (day), m (month), and y (year) older_than: newer_than:
Example: newer_than:2d
Chat messages is:chat
Example: is:chat movie
Search by email for delivered messages deliveredto:
Example: deliveredto:This email address is being protected from spambots. You need JavaScript enabled to view it.
Messages in a certain category category:primary
Messages larger than a certain size in bytes size:
Example: size:1000000
Messages larger or smaller than a certain size in bytes larger: smaller:
Example: larger:10M
Results that match a word exactly +
Example: +unicorn
Messages with a certain message-id header Rfc822msgid:
Example: rfc822msgid:This email address is being protected from spambots. You need JavaScript enabled to view it.
Messages that have or don't have a label has:userlabels has:nouserlabels
Example: has:nouserlabels
Note: Labels are only added to a message, and not an entire conversation.

Let's go over a few helpful examples that use the above operators. Maybe you're a student with a professor who sent out a message with an important document attached, but you can't find it. Something like the below search could help you out:

from:This email address is being protected from spambots. You need JavaScript enabled to view it. has:attachment

Another helpful search is using the "size" operator to look for large messages that may be cutting into your Gmail/Google account storage. The below example would find all messages 5MB or larger:


In terms of filters, maybe your friends and family are constantly sending you videos, and you want to keep them all in one easy-to-access location. You can use a search like the one below, then create a filter with it that adds a label like 'Videos':

has:youtube OR "" OR ""  OR ""

However, there is one issue that affects filters like the one above — Gmail doesn't have a way to search by link URLs. For example, the above filter would only work for messages where the link's text was the URL. The filter would catch messages that spelled out "" or "", but not messages where the link text said something different.

[Source: This article was published in By Corbin Davenport - Uploaded by the Association Member: Issac Avila]


World's leading professional association of Internet Research Specialists - We deliver Knowledge, Education, Training, and Certification in the field of Professional Online Research. The AOFIRS is considered a major contributor in improving Web Search Skills and recognizes Online Research work as a full-time occupation for those that use the Internet as their primary source of information.

Get Exclusive Research Tips in Your Inbox

Receive Great tips via email, enter your email to Subscribe.