Note: This article was originally published in 2009. Some steps, commands, or software versions may have changed. Check the current General documentation for the latest information.

As of late I’ve been running into problems locating the emails I am looking for. Before I was able to type a keyword or two and I could easily find the emails I was searching, but now the amount of similar emails has made search a more cumbersome task. 

Gmail offers advanced search features that allow users to more easily find the emails they are looking for. I particularly use a lot the search feature that allows searching all emails with an attachment.

As users begin to have gigabytes worth of emails in their mailboxes easy searches won’t do the trick any more. Hopefully Google will begin developing a search method that weights many factors and displays relevant search results (sort of like their web search). 

Here is a list of advanced search operators available for Gmail for a quick easy reference: (obtained from the (http://mail.google.com/support/bin/answer.py?hl=en&answer=7190 “Gmail support: Using advanced search”))

OperatorDefinitionExample(s)
from:Used to specify the senderExample - from:amy
Meaning - Messages from Amy
to:Used to specify a recipientExample - to:david
Meaning - All messages that were sent to David (by you or someone else)
subject:Search for words in the subject lineExample - subject:dinner
Meaning - Messages that have the word “dinner” in the subject
ORSearch for messages matching term A or term B*
*OR must be in all capsExample - from:amy OR from:david
Meaning - Messages from Amy or from David
(hyphen)Used to exclude messages from your searchExample - dinner -movie
Meaning - Messages that contain the word “dinner” but do not contain the word “movie”
label:Search for messages by label*
*There isn’t a search operator for unlabeled messagesExample -**  from:amy label:friends**
Meaning - Messages from Amy that have the label “friends” Example -**  from:david label:my-family**
Meaning - Messages from David that have the label “My Family”
has:attachment
Search for messages with an attachmentExample - **from:david has:attachment  **
Meaning - Messages from David that have an attachment
list:Search for messages on mailing listsExample - **list:[email protected]  **
Meaning - Messages with the words [email protected] in the headers, sent to or from this list
filename:Search for an attachment by name or typeExample - filename:physicshomework.txt
Meaning - Messages with an attachment named “physicshomework.txt” Example - label:work filename:pdf
Meaning - Messages labeled “work” that also have a PDF file as an attachment
” “
(quotes)
Used to search for an exact phrase*
*Capitalization isn’t taken into considerationExample - ” i’m feeling lucky”
Meaning - Messages containing the phrase “i’m feeling lucky” or “I’m feeling lucky” Example - subject: “dinner and a movie”
Meaning - Messages containing the phrase “dinner and a movie” in the subject
( )
Used to group words 
Used to specify terms that shouldn’t be excludedExample - from:amy(dinner OR movie)
Meaning - Messages from Amy that contain either the word “dinner” or the word “movie” Example - subject:(dinner movie)
Meaning - Messages in which the subject contains both the word “dinner” and the word “movie”
in:anywhereSearch for messages anywhere in Gmail*
*Messages in Spam  and Trash  are excluded from searches by defaultExample - **in:anywhere movie  **
Meaning - Messages in All MailSpam , and Trash  that contain the word “movie”
in:inbox
in:trash
in:spamSearch for messages in InboxTrash , or SpamExample - in:trash from:amy
Meaning - Messages from Amy that are in Trash
is:starred
is:unread
is:read
Search for messages that are starred, unread or readExample - is:read is:starred from:David
Meaning - Messages from David that have been read and are marked with a star
cc:
bcc:Used to specify recipients in the cc:  or bcc:  fields*
*Search on bcc: cannot retrieve messages on which you were blind carbon copiedExample - **cc:david  **
Meaning - Messages that were cc-ed to David
after:
before:
Search for messages sent during a certain period of time*
*Dates must be in yyyy/mm/dd format.Example - **after:2004/04/16 before:2004/04/18  **
Meaning - Messages sent between April 16, 2004 and April 18, 2004.*
*More precisely: Messages sent after 12:00 AM (or 00:00) April 16, 2004 and before April 18, 2004.
is:chatSearch for chat messagesExample - is:chat monkey
Meaning - Any chat message including the word “monkey”.

Summary

You’ve successfully learned better search emails in gmail. If you run into any issues, double-check the prerequisites and ensure your General environment is properly configured.