How are spam emails spotted?

Kohaku
KohakuSpam is sorted away before it reaches your inbox. How is it told apart?
The answer in 30 seconds
KohakuMany clues are looked at together to make the decision.

Spam is spotted by combining machine learning, which looks at many clues in each email together, such as its text and information about the sender, with fixed rules. "Sender authentication," which checks that the sender is genuine, and the results of users pressing "Report spam" are also used as clues.

Kohaku
KohakuNow, let’s look at it in more detail.
A red, monster-shaped mailbox with a "NO JUNK MAIL" sign
A mailbox with a "NO JUNK MAIL" sign, asking for no unwanted flyers.Photo: Newtown grafitti from Sydney, Australia / CC BY 2.0 / Wikimedia Commons

Looking at thousands of clues together

According to Gmail, each email has thousands of possible clues (signals). Even if an email has a few features common in spam, that alone doesn't make it spam. Machine learning looks at many clues together to decide. It can find patterns in huge amounts of data that the people writing rules might miss, and it can quickly adapt as spam tricks keep changing. It is used together with rule-based protections.

Figure: Putting clues together
Emails pass through a checkpoint where clues from the wording, sender and reports send them to the inbox or the spam box
  1. 1Incoming emails
  2. 2Clues such as the wording, sender checks and user reports
  3. 3Where all the clues are weighed together
  4. 4Normal emails go to the inbox
  5. 5Spam goes to a separate box

Checking that the sender is genuine

The sender is checked, too. SPF is a system that sets which servers are allowed to send mail from a domain (the part of an email address after the @). DKIM is a system in which the sender adds an electronic signature to an email that the receiver can check. In Gmail, if a message can't be checked, a "?" appears next to the sender's name. Still, an unchecked email isn't necessarily spam, and spammers can pass these checks too.

Figure: Checking that the sender is real
SPFsets which senders maysend from a domainDKIMadds an electronicsignature to checkIf it can’t be checkeda “?” appears nextto the sender’s name

Spam is different for each person

One person's spam can be another person's important email, such as a newsletter or notices from an app. So Gmail tailors its protection to each user. The more you use "Report spam," the better it gets at spotting similar emails. If you move an email out of Spam that was put there by mistake, future emails from that sender won't go to Spam.

Kohaku
KohakuWhat is spam to one person may be an important notice to another. That is why it is tailored to each user.

A battle of wits with spammers

Spammers keep trying new tricks as well. In a 2019 explanation, a new system made it possible to catch image-based emails and emails with hidden content, blocking about 100 million more spam emails a day. In 2023, a system that resists text mixed with look-alike or invisible characters was added, raising the spam detection rate by 38% and lowering the rate of normal emails mistaken for spam by 19.4%.

Want to know more?

  • In 2019, Google said it blocks more than 99.9% of spam, phishing and emails carrying malware before they reach Gmail inboxes.
  • Emails with an empty body and subject are sometimes sent to check whether an address is in use. If one looks suspicious, don't reply.
  • Gmail shows a warning for addresses made to look like a sender you know, for example by using the number "0" in place of the letter "O." Hold off on replying or opening links until you can confirm it.
Kohaku
KohakuLooking at clues together and checking the sender, too. With suspicious emails, take a breath before opening any link.

Quick quiz: test yourself

KohakuRemember what you just read? Give it a try!

How is spam spotted?

Show the answer
  1. By one word in the subject
  2. By putting many clues together
  3. By a person reading each one

By putting many clues together Each email has thousands of clues, and machine learning looks at them together, combined with rules, to decide.

Sources
  1. Spam does not bring us joy—ridding Gmail of 100 million more spam messages with TensorFlowGoogle Workspace Blog
  2. Check if your Gmail message is authenticatedGmail Help
  3. Report spam in GmailGmail Help
  4. Improving Text Classification Resilience and Efficiency with RETVecGoogle Online Security Blog

This article was written after checking the sources above as of 2026-10-03. Explanations may change as research progresses. Photo credits are shown below each photo.

Next fun fact ▶

TechnologyWhy is a longer password a stronger password?A short password full of symbols, or a long one: which do you think is stronger?
NANI?! Animal Encyclopedia
Our book is on AmazonNANI?! Animal Encyclopedia

40 surprising animal facts with big photos and short, easy text. A fun-facts book for kids and grown-ups to read together.

See it on Amazon