What Gmail Rules Are and How They Work

Gmail rules are automatic instructions that sort, label, or move your email as messages arrive. Google calls these rules "filters" in its settings menu, but the idea is the same. You tell Gmail what kind of message you want to catch, and Gmail carries out an action on every message that matches. This educational guide explains how filters work so you can understand what they do before you create your own.

Free Guide to Listening to Documents Read Aloud →

Gmail filters only run on new incoming mail by default. A filter you create today will not move the messages already sitting in your inbox unless you choose an option that includes matching older conversations. This is one of the most common surprises for new users. If you expect a filter to clean up years of old email, you may need to run it on existing messages separately.

Gmail also provides built-in sorting that works alongside filters. The inbox can show tabs called Primary, Social, Promotions, and Updates, and you can turn on a Forums tab in the Inbox settings. These tabs use Google's own automatic sorting. Your filters can work with these tabs, but they do not replace them.

The number of filters you can keep is limited. Gmail allows up to 1,000 filters per account, according to Google's help documentation. Most people never reach that number, but people who manage several shared mailboxes or high-volume newsletters sometimes do. Knowing this limit helps you plan your filter list.

Practical takeaway: Filters act on new mail as it arrives, so decide whether you also need to run a rule on messages that are already in your account.

The Two Main Parts of a Gmail Filter

Every Gmail filter has two parts: criteria and actions. Criteria describe the messages you want to find. Actions describe what Gmail should do with those messages. Understanding how these two parts fit together makes it much easier to build a rule that works the way you expect.

Get Your Free Guide to U Pull and Pay Car Recycling →

Criteria are the conditions a message must meet. Gmail offers several fields for this purpose:

  • From: the sender's email address or name
  • To: the recipient field, useful for shared or alias addresses
  • Subject: words found in the subject line
  • Has the words: words found anywhere in the message
  • Doesn't have: words that must not appear in the message
  • Size: messages greater or less than a set size, such as 5 MB
  • Date within: messages received within a chosen time window
  • Has attachment: messages that include a file

Actions tell Gmail what to do next. Common actions include skipping the inbox (which archives the message), marking it as read, starring it, sending it to a chosen label, forwarding it, deleting it, or never sending it to spam. You can combine several actions in one filter. For example, you might label a message, mark it as read, and skip the inbox in a single step.

Gmail also allows you to set more than one criterion. When you fill in several fields, a message must match all of them to trigger the filter. This is a key point. A filter with a sender and a subject line is narrower than a filter with only a sender.

Practical takeaway: Start with one or two criteria and one action. Adding more conditions makes a filter more precise, but it also makes it less likely to catch messages you do want to sort.

How to Create a Gmail Filter on a Computer

Most people create filters from a computer web browser. The process takes only a few minutes, and the steps below follow the layout Gmail has used for years. Menu names may shift slightly over time, so use these steps as a general guide.

Learn About the Disability Portal and How It Works →

  • Open Gmail in your web browser and sign in to your account.
  • Click the small arrow on the right side of the search bar at the top of the page. This opens the advanced search panel.
  • Type your criteria into the fields. For example, enter a sender's address in the From field.
  • Click the button at the bottom of the panel labeled "Create filter."
  • Choose one or more actions, such as "Skip the Inbox" or "Choose label."
  • Check the box for "Also apply filter to matching conversations" if you want the rule to run on older mail. Otherwise, leave it unchecked.
  • Click "Create filter" to save the rule.

Before you finish, Gmail shows a preview of your criteria. Read it carefully. The preview is a quick way to confirm that the search fields match what you intended. If you see a field you did not mean to fill in, go back and clear it before saving.

You can also start from an existing email. Open a message from a sender you want to sort, click the three-dot menu, and select "Filter messages like these." Gmail fills in the search fields for you based on that message. This approach reduces typing mistakes.

Practical takeaway: Use the "Filter messages like these" option when you want to sort messages from a specific sender, and always review the preview before saving.

Using Search Operators to Build Precise Rules

Search operators are short commands you type into the Gmail search bar or into a filter's fields. They let you describe messages with more accuracy than plain words. Learning a few of them can make your rules much more targeted, especially if you receive a large volume of mail.

Free Guide to Budget Transportation Programs and Discounts →

Here are several operators that work well in filters and searches:

  • from: finds messages from a specific sender, such as from:billing@example.com
  • subject: looks only in the subject line, such as subject:"monthly statement"
  • has:attachment finds messages with files attached
  • filename:pdf finds messages with a PDF attachment
  • larger:10M finds messages larger than 10 megabytes
  • newer_than:7d finds messages received in the past seven days
  • list: finds messages sent through a mailing list
  • label: finds messages that already carry a chosen label

You can combine operators with OR and with a minus sign. For example, from:(store@example.com OR shop@example.com) catches mail from either address. Placing a minus sign before a word, such as -sale, excludes messages that contain that word. Quotation marks keep a phrase together, so "account statement" is treated as one unit rather than two separate words.

Test your operators in the search bar before you turn them into a filter. If the search results show the messages you want and nothing else, your filter will likely behave the same way. If the results include unwanted mail, adjust the operators first.

Practical takeaway: Run each search in the Gmail search bar first. A search that works there is a strong starting point for a filter.

Managing, Editing, and Exporting Your Filters

Once you have created filters, you will want to review them from time to time. Gmail keeps all filters in one place, which makes management straightforward. You can edit, delete, or export them at any point.

Free Guide to Illinois DMV Locations Near You →

To view your filters, open Settings from the gear icon, select "See all settings," and choose the "Filters and Blocked Addresses" tab. Each filter appears with its criteria and actions. Click "edit" to change a filter or "delete" to remove it. Changes apply to new mail going forward. They do not undo actions that already happened to older messages.

Gmail also lets you back up your filters. On the same Filters tab, you can export your filter list as an XML file. Keeping this file is useful if you change accounts, share filters with a colleague, or want a record of your setup. To restore them, use the import option on the same page and select the saved file.

Keep an eye on your filter count as well. Because Gmail allows up to 1,000 filters per account, a long list of outdated rules can waste space and make troubleshooting harder. Some users find it helpful to write a short note about each filter's purpose, either in a separate document or in the label name itself.

Practical takeaway: Export your filters to an XML file every few months, and review the list to remove rules that no longer match your mail habits.

Common Filter Examples and Troubleshooting Tips

Many Gmail users follow similar patterns when setting up filters. The examples below show how several common goals can be reached with a single rule. Each example is an illustration of how filters work, not a guarantee of any particular result.

Free Guide to Listening to Documents Read Aloud →

  • Newsletters: From a newsletter address, add a label called "Newsletters," mark as read, and skip the inbox.
  • Receipts: Subject contains "receipt" or "order confirmation," add a label called "Receipts."
  • Large files: Size greater than 20 MB, add a label called "Large Files" so you can review them later.
  • Project mail: To a shared project address, star the message and mark it as important.
  • Noisy alerts: From an automated system, skip the inbox so alerts appear only under their label.

When a filter does not behave as expected, check a few common causes. First, confirm that the sender address is exact, since a small spelling change will stop a match. Second, look at your other fields, because adding a criterion narrows the results. Third, remember that filters do not run on older mail unless you chose that option. Finally, check whether a different filter is acting on the same message, since two rules can conflict.

Gmail's Spam folder deserves a separate note. Messages sent to spam do not reach your inbox, so a filter that skips the inbox will not rescue them. Check the Spam folder if an expected message seems to be missing, and use the "Not spam" option when a legitimate message ends up there.

Practical takeaway: When a filter fails, test the search operators in the search bar, check for conflicting filters, and look in the Spam folder before assuming the rule is broken.