Gmail Advanced search: How to Search Mail in Gmail using Search Operators


Roberto Scaramuzza - Linkedin profile


Roberto Scaramuzza – Linkedin profile

follow r1oby


follow r1oby

SHARE
THIS
PAGE

lonkedin

twitter

facebook

google+

Gmail Search Options

To specify some search criteria for narrowing results in your Gmail search:

  • Click the Show search options down arrow in the Gmail search field.
  • Search senders’ email addresses and names using the From field.
  • Search direct (To: field) recipients’ names and addresses using the To field.
  • Search email subjects using the Subject field.
  • Search emails’ body text using the Has the words field.
    • Search for a phrase with quotation marks.
    • Search for emails that contain one word (or phrase) or another, use “OR”.
      ‘”shepherd macaroni”‘ (excluding the outer quotation marks) finds all emails that contain the phrase “shepherd macaroni”, for instance;
      ‘shepherd macaroni’ (again excluding the quotation marks) finds all emails that contain both words, but not necessarily in that form;
      ‘shepherd OR macaroni’ (without the quotation marks), finally, finds all emails that contain either “shepherd” or “macaroni” (or both).
  • Search for emails that do not contain certain words in their text using the Doesn’t havefield.
  • Make sure Has attachment is checked to find only emails that contain attached files.
  • Search emails’ sent date using the Date within fields.
  • Click the Search Mail button below the search fields.
    • You can now narrow your search further in the main search field using the operators below.
    • Of course, multiple search options can be combined to find, say, emails from a certain sender that contain attachments and were sent during the past year.

Gmail Search Operators

In the Search Mail field, you can use the following operators:

  • subject: – Search the Subject line.
    Example: “subject:bahamas” finds all messages with “bahamas” in the Subject.
  • from: – Search Gmail for sender name and email address. Partial addresses are okay.
    Examples: “from:heinz” finds all messages from “heinz@example.com”, but also all messages from “your.heinz@example.com”; “from:me” finds all messages sent by yourself (using any address set up for use in Gmail).
  • to: – Search the To line for names and addresses.
    Example: “to:quertyuiop@gmail.com” finds all messages sent directly (not via Cc: or Bcc:) to quertyuiop@gmail.com.
  • cc: – Search recipients in the Cc field.
    Example: “cc:quertyuiop@gmail.com” finds all messages that were sent to quertyuiop@gmail.com as a carbon copy.
  • bcc: – Search Gmail for addresses and names in the Bcc field. Note this only works with emails you sent to Bcc recipients from Gmail.
    Example: “bcc:heinz” finds all messages that you sent with, for example, “hein@example.com” in the Bcc field.
  • label: – Search Gmail for messages assigned a label. (Replace whitespace characters in label names with hyphens.)
    Example: “label:toodoo-doll” finds all messages labeled “toodoo doll”.
  • has:userlabels – Search Gmail for emails that have any labels except those used by default (i.e. not including labels such as “inbox”, “trash” and “spam” but including Smart Labels).
  • has:nouserlabels – Search for messages that have not been labeled with any labels except those that Gmail uses by default.
  • is:starred – Search Gmail for messages that are starred.
  • Further stars:
    • has:yellow-star – Search Gmail for messages with a yellow star.
    • has:red-star – Search Gmail for messages with a red star.
    • has:orange-star – Search Gmail for messages with an orange star.
    • has:green-star – Search Gmail for messages with a green star.
    • has:blue-star – Search Gmail for messages with a blue star.
    • has:purple-star – Search Gmail for messages with a purple star.
    • has:yellow-bang – Search Gmail for messages with a yellow exclamation mark.
    • has:red-bang – Search Gmail for messages with a red exclamation mark.
    • has:purple-question – Search Gmail for messages with a purple question mark.
    • has:orange-guillemet – Search Gmail for messages with two orange forward arrows.
    • has:blue-info – Search Gmail for messages with a blue i.
  • is:unread – Search Gmail for new and unread messages.
  • is:read – Search Gmail for messages that have already been opened.
  • is:important – Search Gmail for messages that are marked important for Priority Inbox.
  • has:attachment – Search Gmail for messages that have files attached to them.
  • filename: – Search within file names of attachments. You can also search for file name extensions to restrict your search to certain file types.
    Example: “filename:.doc” finds all messages with word processing attachments.
  • is:buzz – Search Gmail for Google Buzz posts.
  • is:chat – Search Gmail for chat logs.
  • lang: – Search Gmail for messages in a particular language. (Specify the language in English; “Chinese” works, but “中文”, “Putonghua” or “Mandarin” do not, for example.)
    Example: “lang:French” returns all emails that contain at least un peu de Français.
  • in: – Search in a standard “folder”. You can search in DraftsInboxChatsSentSpamTrashand anywhere (for everything, including Spam and Trash).
    Example: “in:drafts” finds all messages in your Drafts folder.
  • circle: – Search mail sent to you from people in the given Google+ circle. (Use quotation marks to specify Google+ circles that include a whitespace in their name; escape quotation marks in the name with a backslash (‘\’) immediately preceding each quotation mark.)
    Example: ‘circle:”my \”sailing\” circle” turns up all emails from people in your ‘my “sailing” circle” Google+ circle.
  • has:circle – Search Gmail for messages from somebody in any of your Google+ circles.
  • after: – Search for messages sent on or after a date. The date must be given in YYYY/MM/DD format.
    Example: “after:2005/05/05” finds all messages sent or received on or after (i.e. including) May 5, 2005.
  • before: – Search Gmail for messages sent before a date.
    Example: “before:2005/05/05” finds all messages sent or received on May 4, 2005 and earlier.
  • larger: (or larger_than:) – Search for emails exceeding the given size. (Specify the size in bytes without suffix or using “k” for kilobytes (as 1,000 bytes) and “m” for megabytes (as 1,000,000 bytes.)
    Example: “larger_than:200k” finds all messages that exceed 200,000 bytes in size.
  • size: – Search for messages exceeding the given size in bytes.
    Example: “size:500000” finds emails bigger than 500,000 bytes or half a megabyte.
  • smaller: (or smaller_than:) – Search for messages smaller than the specified size. (Specify the size in bytes (no suffix) or using “k” for 1,000 bytes and “m” for 1,000,000 bytes.)
  • deliveredto: – Search Gmail for email with a certain email address in a “Delivered-To:” header line.
    Example: “deliveredto:me@example.com” finds messages that have “me@example.com” in a “Delivered-To: header, because it has been forwarded from that address, for example.
  • rfc822msgid: – Search for the message with the — just about certainly unique — message ID. Gmail will not search for messages that refer to the message ID (replies, for example).Example: “rfc822msgid:wW28fb6uf@mail.example.com” finds the message with “wW28fb6uf@mail.example.com” in the “Message-ID:” header field.

Operators and search terms can be combined with the following modifiers:

  • By default, Gmail combines terms with (an invisible) “AND”.
    Examples: “shepherd macaroni” finds all messages that contain both “shepherd” and “macaroni”; “before:2005/05/05 AND after:2005/05/04” finds all messages sent or received on May 4, 2005.
  • “” – Search for a phrase. Case does not matter.
    Examples: “shepherd’s macaroni” finds all messages containing the phrase “shepherd’s macaroni”; ‘subject:”shepherd’s macaroni’ finds all messages that have “shepherd’s macaroni” in the Subject field.
  • + – Search for a term exactly as typed.
    Example: “+shepherds” finds all emails that contain “shepherds”, but not those containing just “shepherd” or “shehperds” alone.
  • OR – Search Gmail for messages containing at least one of two terms or expressions.
    Examples: “shepherd OR macaroni” finds messages that contain either “shepherd” or “macaroni” or both; “from:heinz or label:toodoo-doll” finds messages that either come from a sender that contains “email.guide” or appear under the label “toodoo doll”.
  •  – Search Gmail for messages that do not contain a term or expression.
    Examples: “-macaroni” finds all messages that do not contain the word “macaroni”; “shepherd -macaroni” finds all messages that contain the word “shepherd” but not “macaroni”; ‘subject:”shepherd’s macaroni” -from:heinz’ finds all messages with “shepherd’s macaroni” in the subject that were not sent from an email address or name containing “heinz”.
  • () – Group search terms or expressions.
    Examples: “subject:(shepherd macaroni)” finds messages that have both “shepherd” and “macaroni” somewhere in the Subject line (but not necessarily as a phrase); “from:heinz (subject:(shepherd OR macaroni) OR label:toodoo-doll)” finds all messages from a sender who has “email.guide” in their name that either have “shepherd” or “macaroni” (or both) in the Subject line or appear under the label “toodoo doll”.

Advanced search

Advanced search operators are query words or symbols that perform special actions in Gmail search. These operators allow you to find what you’re looking for quickly and accurately. They can also be used to set up filters so you can organize your inbox automatically. Some of the most useful operators are listed below.

You can also refine your search by clicking the arrow in the search box.

Operator Definition Examples
from: Used to specify the sender Example: from:amy
Meaning: Messages from Amy
to: Used to specify a recipient Example: to:david
Meaning: All messages that were sent to David (by you or someone else)
subject: Search for words in the subject line Example: subject:dinner
Meaning: Messages that have the word “dinner” in the subject
OR Search for messages matching term A or term B*
*OR must be in all caps
Example: from:amy OR from:david
Meaning: Messages from Amy or from David

(hyphen)
Used to exclude messages from your search Example: dinner -movie
Meaning: Messages that contain the word “dinner” but do not contain the word “movie”
label: Search for messages by label Example: 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 attachment Example: from:david has:attachment
Meaning: Messages from David that have an attachment
list: Search for messages on mailing lists Example: list:info@example.com
Meaning: Messages with the words info@example.com in the headers, sent to or from this list
filename: Search for an attachment by name or type Example: 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 consideration
Example: “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 excluded
Example: 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:anywhere Search for messages anywhere in Gmail*
*Messages in Spam and Trashare excluded from searches by default
Example: in:anywhere movie 
Meaning: Messages in All MailSpam, andTrash that contain the word “movie”
in:inbox
in:trash
in:spam
Search for messages in Inbox,Trash, or Spam Example: in:trash from:amy
Meaning: Messages from Amy that are inTrash
is:important
label:important
Search within messages that Priority Inbox considers important. Example: is:important from:janet
Meaning: Messages from Janet that were marked as important by Priority Inbox
is:starred
is:unread
is:read
Search for messages that are starred, unread, or read Example: is:read is:starred from:David
Meaning: Messages from David that have been read and are marked with a star
has:yellow-star
has:red-star
has:orange-star
has:green-star
has:blue-star
has:purple-star
has:red-bang
has:orange-guillemet
has:yellow-bang
has:green-check
has:blue-info
has:purple-question
Search for messages with a particular star Example: has:purple-star from:David
Meaning: Messages from David that are marked with a purple star
cc:
bcc:
Used to specify recipients in thecc: or bcc: fields*
*Search on bcc: cannot retrieve messages on which you were blind carbon copied
Example: cc:david 
Meaning: Messages that were cc-ed to David
after:
before:
older:
newer:
Search for messages sent or received during a certain period of time
(using the date format yyyy/mm/dd)
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.
older_than
newer_than
Similar to older and newer, but allows relative dates using dm, and y for daymonth, and year Example: newer_than:2d
Meaning: Finds messages sent within the last two days.
is:chat Search for chat messages Example: is:chat monkey
Meaning: Any chat message including the word “monkey.”
deliveredto: Search for messages within a particular email address in the Delivered-To line of the message header Example:deliveredto:username@gmail.com
Meaning: Any message with username@gmail.com in the Delivered-To: field of the message header (which can help you find messages forwarded from another account or ones sent to an alias).
circle: Search for messages that were sent from someone who you added to a particular Google+ circle Example: circle:friends
Meaning: Any message that was sent by a person in your “Friends” circle.Examples: circle:”soccer friends (team blue)” or circle:”my \”fab four\””
Notes: For circle names that include a space, parentheses, curly brackets, or vertical bar, add quotes around the name. For names that include quotes, add a back slash immediately before the quotes.
has:circle Search for all messages that were sent from someone who you added to your Google+ circles Example: has:circle 
Meaning: Any message that was sent by a person in any of your circles.
category: Search for messages within a category Example: category:updates
Meaning: All messages in the Updates category.Example: category:social Mindy
Meaning: Messages in the Social category that include “Mindy.”
size: Search for messages larger than the specified size in bytes Example: size:1000000 
Meaning: All messages larger than 1MB (1,000,000 bytes) in size.
larger:
smaller:
Similar to size: but allows abbreviations for numbers Example: larger:10M 
Meaning: All messages of at least 10M bytes (10,000,000 bytes) in size.
+
(plus sign)
Match the search term exactly Example: +unicorn 
Meaning: Finds messages containing “unicorn” but not “unicorns” or “unciorn”
rfc822msgid: Find a message by the message-id header Example:rfc822msgid:200503292@example.com
Meaning: Locates the exact message with the specified SMTP message-id.
has:userlabels
has:nouserlabels
Search for messages that have and have not had labels that you created applied to them.
NOTE: Gmail applies labels to individual messages, not to conversation threads.
Example: has:nouserlabels
Meaning: Finds all messages without any of your own labels (excludes automatic labels like inbox, spam, and trash). Since Gmail applies labels to individual messages, you might see results that appear to have labels; in this case, another message in the same conversation thread has had a label applied to it.

Boolean operators

You can use boolean operators such as ‘OR’ when searching in Gmail.

For example, to look for messages from username@gmail.com and messages that contain the subject line ‘Meeting reminder’, you can enter ‘username@gmail.com OR meeting reminder’ in your Gmail search box.

Using these along with Gmail’s advanced operators can be a great way of making your search criteria more powerful.

The ‘or’ function in Gmail is represented by ‘OR,’ and the ‘not’ function is represented by a minus (-). You also can use quotes (” “) to specify an exact phrase.