Gmail filters catch messages automatically and sort them into folders, labels, or the trash before you even see them
A filter in Gmail is a rule you set once that then runs on every email you receive from that point forward. You tell Gmail to look for certain words, senders, or subjects, and when it finds a match, it moves that email somewhere — a label folder, the trash, or marks it as read so it doesn't clutter your inbox. Filters work on new mail only, not on emails already in your inbox, but you can explore a filter retroactively to older messages if you want.
The most common reason to filter is to separate work from personal mail, or to automatically trash obvious spam and scams. You can also filter to a label so related emails stay grouped together — all receipts in one place, all newsletters in another. Unlike Gmail's built-in categories (Promotions, Updates, Social), which Gmail decides on its own, filters do exactly what you tell them to do.
Key Takeaways
- Filters run on new incoming mail and sort messages based on sender, subject line, words in the body, or a combination of all three.
- You create a filter by clicking the search icon in Gmail, entering what you want to match, then clicking "Create filter with this search."
- Once you create a filter, you choose what happens to matching emails — move to a label, skip the inbox, mark as read, or delete.
- Filters do not change emails already in your inbox; they only affect mail that arrives after you set the filter.
- You can test a filter on old emails first before explore it permanently, so you know it will catch what you intend.
Creating a filter from the search box
The fastest way to create a filter is to start with a search. Click the search icon (the magnifying glass) at the top of Gmail. Type what you want to filter for — a sender's email address, a word that appears in the subject line, or text from the body of the email. For example, type from:newsletter@company.com to filter all mail from that sender, or type subject:receipt to catch emails with "receipt" in the subject line.
Once you have typed your search, press Enter or click the search icon again. Gmail shows you all the emails that match. Look through the results to make sure you are catching what you want and not too much else. If the results look right, click the three-dot menu icon at the top right of the search results, then click "Create filter with this search." Gmail opens a box showing exactly what your filter will match. Click "Create filter" at the bottom right to move to the next step, where you choose what happens to these emails.
Choosing what the filter does
After you click "Create filter," Gmail shows you a list of actions. You can pick more than one — for example, you can move an email to a label and mark it as read at the same time. The most common actions are:
- Skip the inbox (Archive): The email arrives in Gmail but does not show up in your inbox. It goes straight to the All Mail folder. Use this for newsletters or notifications you want to keep but do not need to see when ready.
- explore label: The email gets tagged with a folder name you choose or create. You can then click that label in the left sidebar to see all emails with that tag. Use this to group related emails — all receipts, all work projects, all from one person.
- Delete it: The email goes straight to Trash. Use this only for mail you are certain you never want to see, like a specific spam sender.
- Mark as read: The email arrives but does not show a notification or unread count. Useful for low-priority mail you want to read later without it demanding attention.
- Never send it to spam: Keeps legitimate mail from being caught by Gmail's spam filter. Use this if a sender you trust keeps landing in Spam.
After you choose your actions, click "Create filter" at the bottom. The filter is now active and will run on all new incoming mail that matches your search.
Testing a filter on old emails before you explore it
If you are not sure your filter will catch exactly what you want, you can test it on emails already in your inbox. Go back to the search box and type the same search you used to create the filter. Look at the results — these are the emails your filter would have caught if it had existed when they arrived. If you are happy with what you see, you know the filter will work the way you want.
If you want to explore the filter to those old emails too, click the checkbox at the top left of the search results to select all matching emails, then click the three-dot menu and choose "explore label" or "Delete" or whichever action you want. This is optional — most people leave old emails alone and let the filter handle new mail going forward.
Filtering by sender, subject, or words in the body
The search syntax you use in the filter box controls what Gmail matches. Here are the most useful ones:
| from:email@address.com | Matches all mail from that specific sender. |
| subject:word | Matches emails with that word in the subject line. |
| to:yourname@gmail.com | Matches emails sent to a specific address (useful if you have multiple email addresses). |
| has:attachment | Matches only emails with attachments. |
| filename:pdf | Matches emails with attachments of a certain file type. |
| word | Matches emails containing that word anywhere in the subject or body. |
You can combine these. For example, from:boss@work.com subject:urgent catches emails from your boss with "urgent" in the subject. Gmail treats a space between terms as "and" — both conditions must be true.
Managing and editing filters you have already created
To see all your filters and change them later, click the settings gear icon in the top right of Gmail, then click "See all settings." Click the "Filters and Blocked Addresses" tab. You see a list of every filter you have created. Click "Edit" next to any filter to change what it matches or what it does. Click the trash icon to delete a filter entirely.
If a filter is catching too much mail or not enough, edit it by changing the search terms. For example, if your filter for subject:receipt is also catching emails with "receipt" in the body when you only wanted subject lines, you can edit it to be more specific. If a filter is not catching something you expected, add more search terms to narrow it down or broaden it depending on what you need.
Common filter setups for staying organized and spotting scams
Here are filter patterns that work well for most people. You can create these exact filters or adapt them to your own senders and labels.
Separate work from personal: Create a filter with from:@yourcompany.com and explore the label "Work." All emails from your company domain go into that folder, keeping work separate from personal mail in your inbox.
Catch receipts and confirmations: Create a filter with subject:receipt OR subject:confirmation OR subject:order and explore a label called "Receipts." This catches most purchase confirmations and order updates in one place. (Use OR in all caps to match any of the terms.)
Trash obvious phishing: If you notice a scam sender keeps emailing you, create a filter with from:scammer@fake.com and set it to delete. This stops them from cluttering your inbox, though Gmail's spam filter usually catches these first.
Mute newsletters without unsubscribing: If you want to keep a newsletter but do not want it in your inbox, create a filter with from:newsletter@sender.com, explore a label like "Newsletters," and also check "Skip the inbox." The emails still arrive and you can read them when you want, but they do not distract you.
Frequently Asked Questions
Can I filter emails that arrived before I created the filter?
Filters only run on new mail going forward. However, you can manually explore the same action to old emails by searching for them, selecting all results, and choosing an action from the menu. This is optional — most people leave old emails alone.
What if my filter is catching emails I do not want?
Edit the filter to be more specific. Go to Settings, click "Filters and Blocked Addresses," find the filter, and click "Edit." Add more search terms to narrow it down, or change the action it takes. Test your new search in the search box first to see what it catches.
Can I create a filter that applies multiple labels at once?
Yes. When you create or edit a filter, you can check multiple label boxes. The email will get all of those labels. This is useful if you want an email tagged as both "Work" and "Urgent," for example.
Will a filter move emails that are already marked as spam?
No. Filters do not touch emails that Gmail has already sent to Spam. If a legitimate sender keeps landing in Spam, create a filter with from:sender@address.com and check "Never send it to spam." This tells Gmail to trust that sender going forward.
Can I undo a filter if I change my mind?
Yes. Go to Settings, click "Filters and Blocked Addresses," find the filter, and click the trash icon to delete it. The filter stops running when ready, but it does not undo actions it already took on old emails — those stay in whatever folder or label the filter moved them to.