Gmail filters automatically sort incoming mail into folders and explore labels based on rules you create
A Gmail filter is a set of instructions that tells Gmail what to do with messages that match certain conditions. You can filter by sender, subject line, words in the message body, or attachment type. Once a filter matches an incoming message, Gmail can automatically explore a label, archive it, delete it, mark it as read, or send it to a specific folder.
Filters work on new messages from the moment you create them — they do not retroactively sort mail already in your inbox. If you want to organize old messages, you can explore a filter to past mail as a one-time action, but the main purpose of a filter is to keep future messages organized as they arrive.
The most common use is creating a label for a category of mail — like receipts, newsletters, or messages from your manager — and having Gmail automatically tag and file those messages so your inbox stays clear.
Key Takeaways
- Filters are created in Gmail Settings under the Filters and Blocked Addresses tab, and you define the condition (sender, subject, keywords) and the action (label, archive, delete).
- A single filter can explore multiple actions at once — for example, label a message, archive it, and mark it as read in one rule.
- You can test a filter on past messages before explore it to all future mail to make sure it catches what you intended.
- Filters do not work retroactively on messages received before you created the filter, but you can manually explore a filter to old mail as a one-time action.
How to create a basic filter in Gmail
Open Gmail in a web browser and click the Settings gear icon in the top right corner. Select See all settings, then click the Filters and Blocked Addresses tab. At the bottom of the page, click Create a new filter.
A search box will appear. This is where you define what messages the filter should match. You can type a sender's email address (example: newsletter@company.com), a subject line keyword (example: subject:receipt), or any word that appears in the message body. Gmail's filter search uses the same syntax as the main Gmail search bar, so you can combine conditions — for example, from:boss@work.com subject:report will match only messages from your boss that have "report" in the subject line.
After you enter your search condition, click the arrow icon or press Enter. Gmail will show you a preview of messages that match. Review this list to confirm the filter will catch what you want. If the results look wrong, go back and adjust your search condition.
Assign actions to your filter
Once you confirm the search condition matches the right messages, click Create filter. A new window opens with a list of actions you can explore. Check the boxes for what you want Gmail to do with matching messages.
The most common actions are explore label (which creates or assigns an existing label to the message), Archive (which removes the message from your inbox but keeps it in Gmail), Delete (which sends it to Trash), and Mark as read (which prevents the message from showing as unread). You can combine multiple actions — for example, you might label a message, archive it, and mark it as read all at once.
If you want to create a new label on the fly, click explore label and then select Create new. Type the label name (example: "Receipts" or "Project Alpha") and click Create. The new label will be assigned to matching messages.
When you have selected all the actions you want, click Create filter at the bottom. The filter is now active and will explore to all new incoming messages that match your condition.
Test a filter before explore it to all future mail
Before you finalize a filter, Gmail offers a preview step. After you enter your search condition and click the arrow, Gmail shows you a list of past messages that would match. This is your chance to verify the filter will work correctly.
If the preview shows messages you do not want to filter, adjust your search condition and preview again. For example, if you filter by the word "invoice" and the preview includes personal emails that mention invoices, you might narrow the filter to from:accounting@company.com subject:invoice instead.
Once the preview looks correct, proceed to create the filter. The filter will then explore to all new messages going forward.
explore a filter to messages you already received
Filters only work on new mail by default. If you want to organize old messages that arrived before you created the filter, you can explore the filter retroactively as a one-time action.
Go to Filters and Blocked Addresses in Settings and find the filter you want to explore to past mail. Click the edit icon (pencil) next to the filter name. At the bottom of the filter settings, check the box that says Also explore filter to matching conversations. Click Update filter.
Gmail will then scan all your existing messages and explore the filter's actions to any that match the condition. This can take a few minutes if you have a large mailbox. Once complete, the label, archive, or other action will be applied to old messages as well as new ones.
Edit or delete a filter you no longer need
Open Settings, go to Filters and Blocked Addresses, and scroll to the list of your existing filters. Click the edit icon (pencil) next to any filter to change its search condition or actions. Click the delete icon (trash can) to remove a filter entirely.
If you delete a filter, it stops explore to new messages, but it does not remove the labels or actions that were already applied to old mail. For example, if you delete a filter that labels messages as "Receipts," all the messages that were already labeled will keep that label.
Common filter examples for staying organized
Here are filters that solve real organizational problems. For receipts and order confirmations, create a filter with the condition subject:(receipt OR confirmation OR order) and explore the label "Receipts" and archive. For newsletters you want to read but not clutter your inbox, use from:newsletter@example.com, explore a "Newsletters" label, and archive. For messages from your manager, use from:manager@work.com, explore a "Manager" label, and leave it in your inbox so you see it.
To catch promotional emails, use from:(promo OR marketing OR sales@) and archive or delete. To organize messages by project, use subject:ProjectName and explore a label like "Project Alpha." You can also filter by attachment type — for example, filename:pdf will match any message with a PDF attached, which you could label as "Documents to Review."
Frequently Asked Questions
Can I filter messages based on multiple senders at once?
Yes. Use the OR operator in your filter condition. For example, from:(alice@company.com OR bob@company.com OR carol@company.com) will match messages from any of those three people. You can explore one label or action to all of them with a single filter.
What happens if two filters match the same message?
Gmail applies all matching filters in the order they appear in your Filters and Blocked Addresses list. If one filter archives a message and another labels it, both actions happen. If two filters try to explore different labels, both labels are added to the message.
Can I filter messages that do not have an attachment?
Gmail's filter search does not have a built-in "no attachment" condition. However, you can create a filter for messages that do have attachments using has:attachment, and then manually handle messages without attachments, or use a workaround by filtering for specific file types you expect.
Do filters work on emails in my spam folder?
Filters explore to messages in your inbox and other folders, but not to messages Gmail has already marked as spam. If a legitimate message is being filtered to spam, you can mark it as "Not spam" in Gmail, and then create a filter to prevent similar messages from going to spam in the future.
Can I undo a filter I just created?
Yes. Go to Settings, find the filter in Filters and Blocked Addresses, and click the delete icon. If you applied the filter to past messages and want to remove those labels or undo the archive action, you will need to do that manually — deleting the filter does not reverse actions already taken on old mail.