Gmail rules: how to set them up

Gmail has rules, it just calls them filters. You build one from a search, pick what should happen to matching mail, and Gmail runs it on every new message.

If you're coming from Outlook, you're looking for "rules." Gmail has the same thing under a different name: filters. A filter is a search you save, plus the actions Gmail should take on any new message that matches it. Label it, archive it, star it, forward it, delete it.

Everything below is Gmail on the web. The Gmail apps for Android and iPhone don't have a filter editor, so build rules on a computer (or in a phone browser switched to the desktop site). Once saved, a filter applies to your mail everywhere, the apps included.

How to create a rule in Gmail

There are three ways in, and they all end at the same two-step form.

From the search bar (the usual way). Click the Show search options icon at the right end of the Gmail search bar. Fill in the conditions, click Search to check what comes back, then click Create filter.

From an email you already have. Tick the checkbox next to the message, open the More menu (three dots), and choose Filter messages like these. Gmail pre-fills the sender, which is usually what you want.

From Settings. Gear icon, See all settings, Filters and Blocked Addresses, Create a new filter. This is also where every rule you've made lives, ready to edit or delete.

On the actions step, pick one or more actions and click Create filter. If you want the rule to clean up mail that's already sitting in your account, tick Also apply filter to matching conversations before saving. Skip it and the rule only touches mail that arrives from now on.

Illustration of Gmail's filter actions step with the option to also apply the filter to matching conversations checked
Tick this box to run a new rule over the mail you already have.

The conditions a rule can use

The first step of the form is Gmail's search options, and a rule matches exactly what that search matches. Test in search before you save.

ConditionWhat it matchesTip
FromThe sender's address@example.com catches every address at that domain
ToThe recipient lineMisses mail where you were BCC'd
SubjectWords in the subject linePut exact phrases in quotes
Has the wordsWords anywhere, including the bodyAccepts search operators like list: or category:
Doesn't haveWords that rule a message outGood for excluding receipts from a shop's promotions
SizeMessages larger or smaller than a sizeHandy for routing heavy attachments
Has attachmentAny message with a file attachedCombine with From for invoices

The actions a rule can take

  • Skip the Inbox (Archive it). The mail goes straight to All Mail. This is how you auto archive in Gmail.
  • Mark as read. Pairs well with Skip the Inbox for mail you want kept but never want to see arrive.
  • Star it.
  • Apply the label. Gmail's version of moving mail into a folder. See how to create folders in Gmail for setting labels up.
  • Forward it to. Only works after the destination address is added and verified under Forwarding and POP/IMAP.
  • Delete it. Sends matching mail to Trash, which Gmail empties after 30 days. Read how to auto delete spam safely before using this one.
  • Never send it to Spam.
  • Always mark it as important and Never mark it as important.
  • Categorize as. Moves mail into a tab: Primary, Social, Updates, Forums or Promotions.

Five rules worth copying

Paste the condition into the search bar, check the results, then create the filter.

  1. Receipts into one label. Has the words: receipt OR invoice OR "order confirmation". Action: Apply the label "Receipts". Add Skip the Inbox if you never read them on arrival.
  2. One sender's whole domain. From: @example.com. Senders rotate between news@, offers@ and hello@, and a single-address rule misses the siblings.
  3. Bank and card alerts you can't miss. From: your bank's domain, for example @yourbank.com. Actions: Star it and Always mark it as important.
  4. Keep a sender out of Spam. From: the address Gmail keeps misfiling. Action: Never send it to Spam.
  5. Big attachments, labeled. Size greater than 10 MB. Action: Apply the label "Large". Useful when storage runs low, and pairs with arranging Gmail by size.

What a Gmail rule can't do

  • It doesn't run on old mail by default. Tick "Also apply filter to matching conversations", or the rule looks broken. That's the first cause in Gmail filters not working.
  • It runs once, on arrival. You can't write "archive this after 30 days." A rule acts when the message lands, and conditions like older_than: are always false for mail that just arrived.
  • It can't take you off a mailing list. A rule that archives or deletes a newsletter hides it. The sender keeps mailing you, every new sender needs a new rule, and the mail you keep still counts against storage.

That last one is where most rule collections go wrong. A few hundred filters that shovel newsletters out of sight are really a list of unsubscribes nobody did. For subscription mail, get off the list and let rules handle the mail you actually want to keep.

Our extension does the unsubscribing in bulk. It scans your Gmail, lists every subscription sender, and unsubscribes from the ones you pick using each sender's own unsubscribe mechanism, with a per-sender result so you can see which ones failed. The old mail can be archived in the same pass. For a sender that ignores unsubscribes, block the address.

Swap the newsletter filters for unsubscribes. Scan your inbox, pick the senders you're done with, and get off their lists in one sitting.

Add to Chrome, free

Quick answers

Does Gmail have rules?

Yes, under the name filters. Settings, See all settings, Filters and Blocked Addresses shows every one you've made.

Can I create a Gmail rule on my phone?

Not in the Gmail app. Use Gmail on a computer, or a phone browser with the desktop site turned on. The rule then works in the app too.

Can I copy my rules to another Gmail account?

Yes. In Filters and Blocked Addresses, tick the filters you want and click Export to download them as an .xml file. In the other account, click Import filters, choose the file, and click Create filters.

Why isn't my rule working?

Usually because it only runs on new mail, or the conditions almost match. Gmail filters not working walks through all six causes.