If you are a Gmail user, you’ve probably noticed the annoying unread message count for the Spam folder. It’s even worse when you use an IMAP client to access your email, and then try and use a search folder for unread mail… which gives you nothing but spam.

What we’ll do is use Gmail’s filter capabilities to create a filter that automatically marks spam messages as read, preventing the unread count from appearing anywhere.

This method should work for both Gmail as well as any IMAP client that you use. (Note: This only works if you are using the new gmail interface.)

Mark All Spam as Read Automatically

Open up Gmail and then click the link to create a new filter. In the “Has the words” box, enter “in:spam” (without the quotes) as you can see in the image below. You can use the Test Search button to make sure it shows just spam emails.

Now click the Next Step button, and ignore the error message you get. Select the checkbox for “Mark as read”, and then click the Create Filter button. Note that you could auto-delete all spam using this same filter, although I’m not recommending that.

At this point, all incoming spam will be automatically marked as read. (You’d want to clear out the current spam, of course)

The best part is that you no longer have to deal with the unread count in your IMAP client either:


I don’t understand why some of this spam isn’t just automatically deleted.

Profile Photo for Lowell Heddings Lowell Heddings
Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work.
Read Full Bio »