How To Create Filters In Gmail To Sort Mail (2026)
A Gmail filter sorts new mail for you by labeling, archiving, starring, deleting or forwarding it as it arrives.
You build one from the search box at the top of Gmail on a computer, and it takes about a minute.
The steps below follow Google’s Gmail Help pages for filters, search operators and organizing mail.
Quick answer: create a filter in Gmail
| Task | How to do it |
|---|---|
| Create a filter | Click Show search options in the search box, enter criteria, click Create filter, choose an action, click Create filter |
| Create one from an email | Check the email, click More, click Filter messages like these |
| Edit or delete a filter | Settings, See all settings, Filters and Blocked Addresses, Edit or Delete |
| Export or import filters | Filters and Blocked Addresses, Export or Import filters |
Create a filter from the search box
- Open Gmail on your computer.
- In the search box at the top, click the Show search options icon.
- Enter your search criteria.
- Optional: click Search first to see which emails match.
- At the bottom of the search window, click Create filter.
- Choose the action you want the filter to take.
- Click Create filter.
The filter then applies to the mail that matches your criteria.
Create a filter from an email you already have
- Open Gmail and check the box next to the email.
- Click More.
- Click Filter messages like these.
- Enter or adjust the filter criteria.
- Click Create filter.
This is the quickest way to filter a sender you keep receiving mail from.
What a filter can do
Google’s filter page lists these actions when you create a filter.
| Action | What it does |
|---|---|
| Label | Puts a label on matching mail so it is easy to find in the left panel |
| Archive | Removes matching mail from the inbox while it stays in All Mail |
| Star | Marks matching mail with a star |
| Delete | Deletes matching mail |
| Forward | Forwards matching mail to an address you have set up |
Be careful with the delete action, because a filter that matches too much can remove mail you wanted.
Search operators you can use for the criteria
Filters use the same search criteria as Gmail search, so these operators from Google’s search page work.
| Operator | What it finds | Example |
|---|---|---|
| from: | Mail sent by a person | from:[email protected] |
| to: | Mail sent to a person | to:[email protected] |
| subject: | A word or phrase in the subject line | subject:dinner |
| has:attachment | Mail with an attachment | has:attachment |
| filename: | Attachments with a certain name or type | filename:pdf |
| larger: | Mail larger than a size | larger:10M |
| list: | Mail from a mailing list | list:[email protected] |
| label: | Mail under a label | label:important |
Combine criteria
- OR or braces match one or more criteria, such as from:amy OR from:david.
- AND matches all criteria, such as from:amy AND to:david.
- A minus sign excludes mail, such as dinner -movie.
- Quotation marks match an exact phrase, such as “dinner and movie tonight”.
- Parentheses group terms, such as subject:(dinner movie).
More operators for narrower filters
Google’s search page lists many more operators that you can type into the criteria.
| Operator | What it finds | Example |
|---|---|---|
| cc: and bcc: | Mail that includes a person in the Cc or Bcc field | cc:[email protected] |
| newer_than: and older_than: | Mail newer or older than a period, using d, m or y | newer_than:2d |
| after: and before: | Mail received within a date range | after:2004/04/16 |
| category: | Mail in an inbox category such as primary, social, promotions, updates or forums | category:promotions |
| is: | Mail with a status such as important, starred, unread or read | is:unread |
| deliveredto: | Mail delivered to a specific address | deliveredto:[email protected] |
| in:anywhere | Searches all of Gmail, including Spam and Trash | in:anywhere |
Filtering calendar invitations
Google gives calendar invitations as a case where filters help when you receive a high volume of them.
Its tip is to filter by specific notification types, such as archiving routine accepted invitations.
Test the criteria before you save
Click Search in the search window first, so you can see which emails the criteria match.
If the list includes mail you do not want filtered, change the criteria before you click Create filter.
Filters and mail you already have
Google’s filter page does not describe applying a filter to older conversations.
To organize mail already in your inbox, search for it, check the messages and use Labels at the top.
Google says a forwarding filter applies only to new messages, so existing mail is not forwarded.
Replies are filtered only if they match
According to Google, a reply to a filtered message is not caught automatically.
It is filtered only when the reply itself meets the filter’s search conditions.
You can put several operators together in one filter, for example a sender plus has:attachment, so that only matching mail is touched.
Start with narrow criteria and widen them later, because it is easier to add mail to a filter than to find what a broad filter hid.
Edit or delete a filter
- Click Settings at the top right, then See all settings.
- Click Filters and Blocked Addresses.
- Find the filter you want to change.
- Click Edit to change it, or Delete to remove it.
- If you edit, click Continue when finished.
- Click Update filter or OK.
Export or import your filters
| Action | Steps |
|---|---|
| Export | In Filters and Blocked Addresses, check the box next to the filters, then click Export at the bottom for an .xml file |
| Import | Click Import filters at the bottom, choose the filter file, click Open file, then click Create filters |
Google says the exported .xml file can be edited in a text editor.
Filters compared with other ways to sort mail
Google notes that Gmail filters do not need to run on a schedule the way Outlook rules do.
| Tool | What it does |
|---|---|
| Filter | Sorts matching mail automatically as it arrives |
| Mute | Sends future replies in a thread straight to the archive |
| Snooze | Returns a message to the inbox at a day and time you choose |
If a filter is not doing what you expect
Open Filters and Blocked Addresses and check that the criteria are what you meant and the action is correct.
Our guide to Gmail forwarding and filters not working covers the common causes.
Related Gmail guides
- How to fix Gmail forwarding and filters not working
- How to create and use labels in Gmail
- How to unsubscribe from emails in Gmail
- How to create email filters in Yahoo Mail