Spam, junk and blocking

How to set a spam filter in Gmail

Gmail already runs a spam filter on every message. You cannot configure it, but you can train it, add to it, and stop it catching mail you want.

Updated Alec Lindsay5 min read

On this page

You cannot set Gmail's spam filter directly, because Google runs it automatically on every message. You shape it in three ways: click Report spam on junk that gets through, block senders who keep coming back, and create your own filter for patterns Gmail misses. Those three together are what "setting a spam filter in Gmail" means in practice. Use Gmail on a computer for the filter steps, since the apps have no filter editor.

What the built-in filter does

Gmail checks every incoming message and sends the ones it judges to be spam or phishing to the Spam folder, where they are deleted after 30 days. It makes that call from signals such as the sender's reputation, whether the message passes authentication checks, the content, and how people have reported similar mail.

There is no switch to turn it off and no slider to make it stricter. That is why the useful controls are the ones that feed it or sit beside it.

Step 1: Report spam to train the filter

When junk reaches your inbox, tell Gmail.

  1. Open the message, or tick it in the list.
  2. Click the Report spam icon in the toolbar (a stop sign with an exclamation mark).
  3. The message moves to Spam, and the report helps Gmail catch similar mail.
Illustration of Gmail's Report spam button in the message toolbar
Report spam is the main way to train Gmail's filter. Use it on genuine junk, not on newsletters you can unsubscribe from.

The same applies in reverse. If a real message lands in Spam, open it and click Report not spam. Doing this consistently is the closest thing Gmail offers to adjusting the filter's sensitivity.

Step 2: Block senders that keep coming back

Blocking is a per-address rule. Open a message from the sender, click the three dots next to Reply, and choose Block. From then on, mail from that address goes to Spam. The full walkthrough, including phone steps and how to unblock, is in how to block an email address in Gmail.

Blocking has a limit. Spammers rotate addresses and domains, so blocking one address often catches only a fraction of what they send. For a pattern, use a filter.

Step 3: Create your own spam filter

A filter is where you set rules yourself. It catches mail by sender, domain, or words, and does something with it.

  1. Click the Show search options icon at the right end of the search bar.
  2. Enter what identifies the junk. For example, put @spam-domain.com in From, or a phrase such as "you have won" in Has the words.
  3. Click Search and check the results. A filter matches exactly what this search matches, so make sure no real mail is in the list.
  4. Click Create filter.
  5. Tick Delete it to send matches to Trash.
  6. Tick Also apply filter to matching conversations to clear what is already in your account, then click Create filter.

Two things to know. Gmail filters have no "Mark as spam" action, so Delete it is the equivalent for mail you never want to see. And filters only change where mail goes. The sender still has your address. For the safe way to automate deletion, read how to auto delete spam in Gmail without losing real mail.

Useful conditions for spam:

GoalCondition
A whole sender domainFrom: @example.com
Several senders at onceFrom: a@example.com OR b@example.net
A recurring phraseHas the words: "limited time offer"
Messages with a particular subjectSubject: "invoice attached"

Keep conditions specific. A filter on a common word deletes real mail along with the junk.

Keeping good mail out of Spam

The filter makes mistakes in the other direction too. Gmail has no safe sender list, but a filter does the same job:

  1. Open the message in Spam and click Report not spam.
  2. Search for the sender, click Show search options, and click Create filter.
  3. Tick Never send it to Spam, then click Create filter.

That tells Gmail to skip its spam check for that sender. It is worth doing for receipts, bank alerts, and anyone whose mail you cannot afford to miss.

Spam versus mail you signed up for

Most of what clutters an inbox is not spam. It is newsletters, promotions, and notifications from senders you gave your address to. Reporting those as spam trains Gmail on the wrong signal and does nothing about the sender. The right fix is to unsubscribe, which stops the mail at the source.

Reserve Report spam, blocks and delete filters for senders you never signed up with. For the rest, our extension scans your Gmail, lists every subscription sender, and unsubscribes from the ones you choose in bulk, using each sender's own unsubscribe mechanism. How to stop spam emails in Gmail explains how to tell the two apart, and Gmail rules covers what else filters can do. If a filter you built isn't working, see Gmail filters not working.

Filters stop junk you never asked for. For the newsletters and promotions you did sign up for, scan your inbox and unsubscribe in bulk.

Add to Chrome, free

Common questions

Can I turn the Gmail spam filter on or off?

No. Gmail has no setting that switches its spam filter on, off or to a stricter level. Google runs it on all mail. What you control is training it with Report spam and Report not spam, and adding your own filters and blocked addresses on top.

Is there a safe sender list in Gmail?

Not as a list. The nearest thing is a filter on the sender with Never send it to Spam ticked, which stops Gmail putting that sender in Spam. Adding someone to your contacts also helps, but a filter is the firmer guarantee.

Can a Gmail filter send mail to Spam?

No. Gmail filters have no "Mark as spam" action. To send a sender to Spam, block them: blocked senders go to Spam automatically. To get rid of mail without it landing anywhere, use a filter with Delete it, which sends it to Trash.

How long does Gmail keep mail in Spam?

Gmail deletes messages in Spam after 30 days. You can empty the folder sooner with Delete all spam messages now at the top of the Spam view.

Why is real mail going to my Spam folder?

Gmail judged it suspicious, often because the sender is new, the message failed authentication, or similar mail was reported by others. Open it, click Report not spam, and add a filter with Never send it to Spam for that sender. See how to mark a message Not spam.

Should I click unsubscribe on spam?

Not on real spam, since a reply tells the sender your address is live. Report and block it instead. For newsletters you signed up to, unsubscribing works and is the better fix. How to stop spam emails in Gmail explains the difference.