Gmail Filters: How to Create and Apply One
In this article
The short answer: in Gmail on a computer, click the search bar, fill in the criteria you want with the search operators, then click Create filter at the bottom of the search options, choose the actions you want, and click Create filter again. You can also filter an existing message by opening it and choosing Filter messages like these from the three-dot menu, which fills in the criteria for you. Filters run automatically on new mail as it arrives, so applying a filter means creating (or editing) a rule with Apply the filter to matching conversations checked so it also touches mail already in your mailbox.
A quick note on wording: menu labels can differ slightly by version, region and device, so if a label below does not match exactly, look for the closest equivalent. The filter builder is only available in the full Gmail web interface in a browser, not in the Gmail mobile app.
What You'll Need
- A Gmail account signed in on a computer browser (Chrome, Firefox, Edge or Safari). The filter builder is not in the Gmail iOS or Android app.
- The standard desktop layout of Gmail. If you are using the basic HTML view, switch to the standard view first.
- Between 0 and 8 filter rules left, because Gmail limits each account to 1,000 filters.
- Optionally, a test email you can send yourself so you can confirm the filter works before trusting it with real mail.
Step-by-Step
- Open Gmail and the search bar. At the top of the inbox, click the search box. Do not type a keyword yet; instead click the small filter icon or the Show search options sliders icon at the right end of the search bar. A panel drops down with fields such as From, To, Subject, Has the words, Doesn't have, Size, Date within, Search (all mail, inbox and so on), and Has attachment.
- Fill in the criteria. Add only what you need. For example, put a newsletter address in From, or put an order number in Has the words. Leave a field empty if you do not care about it. If you prefer to type directly, the same fields work as operators in the search bar:
from:,to:,subject:,has:attachment,older_than:. Getting the operator wrong is the most common reason a filter matches nothing. - Test the criteria before saving. Click Search. Check the results are the messages you expect and not everything in your mailbox. If the search returns too many results, add another condition (a subject word, or Doesn't have a word you see in unrelated mail). This step saves you from a filter that files away half your inbox.
- Open the filter builder. With the results showing, click the sliders icon again, or go back to the search panel and click Create filter at the bottom right of the panel. The panel keeps your criteria, and a new screen lists the actions you can choose.
- Pick the actions. Tick the ones you need: Skip the Inbox (Archive it), Mark as read, Star it, Apply the label (choose or create a label), Forward it to (only addresses you have verified), Delete it, Never send it to Spam, Always mark it as important, Never mark it as important, Categorize as, and Also apply filter to matching conversations.
- Decide about existing mail deliberately. If you want the rule to affect mail already sitting in your inbox or archive, tick Also apply filter to matching conversations. Leave it unticked if you only want future messages handled. This checkbox is the difference between a filter that cleans up your existing mess and one that only works from now on.
- Click Create filter. The rule saves immediately. To confirm, look under Settings (the gear icon) > Filters and Blocked Addresses. The same page lists every filter with its criteria and actions, and lets you edit or delete one.
- Verify with a test message. Send yourself a message that matches the criteria from another address, or ask a sender to email you. Wait for it to arrive, then check that it has the label, is archived, or is marked read as you intended. If it did not work, compare the sender address character by character with your filter criteria.
Common Mistakes
- Mistyping the sender address. A filter on From matches the actual sending address, not the display name. A newsletter that appears as "Shop News" may really come from a long subdomain address. Copy the address from the message header rather than retyping it.
- Choosing Delete when Archive was intended. Delete moves matching mail to Trash, where it is removed automatically after about 30 days. Archive keeps the mail searchable and out of the inbox, which is usually what people want from a filter.
- Forgetting the checkbox for existing mail. Creating a filter does not retroactively change messages already in Gmail unless you tick Also apply filter to matching conversations. Many people assume it did.
- Building a filter that is too broad. A single word like "invoice" in Has the words can catch personal, work and spam mail at once. Combine terms with several fields or use an exact phrase in quotes.
- Expecting filters to run in the mobile app. Filters you create on the web apply to all your mail on every device, but you cannot create one from the phone app's message actions.
- Forwarding to an address you have not verified. Gmail sends a confirmation link to the target address first. The filter will not deliver until that link is clicked.
Tips
- Create a label first when you want filing to be tidy: Settings > Labels, or the Create new label option in the left sidebar, then choose that label in the filter's Apply the label action.
- Combine Skip the Inbox with Apply the label to keep receipts and newsletters out of sight but findable. Combine Skip the Inbox with Mark as read only if you truly never want unread counts from those senders.
- Use Never send it to Spam for legitimate senders whose mail keeps landing in Spam, such as a bank or a family member.
- Use Never mark it as important or Categorize as to quiet senders that keep triggering Priority Inbox or the tabbed inbox.
- Order matters with overlapping filters: Gmail applies all matching filters, so avoid two rules that label the same sender differently. Check Filters and Blocked Addresses and delete duplicates.
- Export a backup of your rules from Settings > Filters and Blocked Addresses using Export. You can import that file into another account or restore rules later.
- Keep the total under 1,000 filters. If you hit the limit, merge related rules into one filter with several criteria.
Troubleshooting
- A filter is not matching anything. Open the filter under Filters and Blocked Addresses and check the exact criteria text. Copy the sender address from the message itself using Show original in the three-dot menu if you need the real header address. Also check whether the message arrived before you created the filter.
- Mail is being archived that should stay in the inbox. Edit the filter and untick Skip the Inbox. To bring archived mail back, search for it, select the messages and use Move to Inbox from the toolbar.
- Forwarding does not work. The target address must be confirmed by clicking the email Gmail sends it, and the sending account may also need forwarding verification. Check the forwarding section of Settings.
- A filter seems to make spam worse or skips over mail you wanted. Check whether another filter with overlapping criteria is doing the opposite action. Remove or edit the conflicting rule, then test again.
- You cannot find the filter option on your phone. That is expected. Use a browser, and if you want a desktop-style site on a tablet, request the desktop version of the page. Filters created on the web still apply to mobile mail.
- A filter is broken and you want a clean slate. Deleting a filter only stops future matching; it does not undo labels or archives already applied. Delete the rule under Filters and Blocked Addresses, then tidy the affected messages manually with a search and bulk action.
Frequently Asked Questions
Can I apply a filter to emails I already received?
Yes. When you create the filter, tick Also apply filter to matching conversations before you click the final Create filter. You can also edit an existing filter and tick that box, but be aware it will act on the entire matching set, including very old mail.
Do Gmail filters work on the mobile app?
The filters apply to all mail in the account, so their effect is visible in the iOS and Android apps. Creating and editing filters, however, is done in the full web interface in a browser.
How many filters can I have?
Gmail allows up to 1,000 filters per account. Each filter can also have several criteria, which is a useful way to stay under the limit.
What happens if two filters match the same email?
Both run. If they conflict, for example one archives and one keeps mail in the inbox, the result can be surprising. Keep rules non-overlapping and remove duplicates when you notice odd behaviour.
Can I filter by attachment name or by a word in the body?
You can filter by attachment presence with Has attachment, and by words in the body with Has the words. Gmail's filter builder does not offer a dedicated field for attachment file names, so use a word in the subject or body instead.
Does deleting a filter move messages back to the inbox?
No. Deleting a filter stops it applying to future mail only. Messages it already archived, labelled or deleted stay that way, so undo those changes with a search and bulk action.