How to Use Search Operators to Find Emails in Gmail

Find exactly what you need with these tips and tricks

Person searching Gmail for

Lifewire / Tim Liedtke

Gmail's advanced search capabilities help you find precisely what you're looking for fast using search operators — special characters and parameters that let you fine-tune a search. Gmail's robust search features are especially handy given the vast amount of storage Gmail offers; a manual search through your vast trove of archived emails would be nearly impossible otherwise. When a simple text entry in the search field at the top of Gmail's screen returns too many emails, you can use these operators to search by subject line, date range, sender, and much more.

Simple Searches

To find messages in Gmail, a good first approach is to simply type search terms in the search field.

Gmail main screen

Gmail offers lots of keyboard shortcuts. Type / (the forward slash on your keyboard) to get to Gmail's search bar in an instant.

Gmail Search Options

When a simple search yields too many results or not those you need, you can specify criteria for narrowing results. Click the Show search options down arrow in the Gmail search field to open an advanced search window.

Gmail's Search options dialog

Here, you can:

  • Search senders' email addresses and names using the From field.
  • Search recipients' names and addresses using the To field.
  • Search email subjects with the Subject field.
  • Search body text using the Has the words field.
  • Search for emails that do not contain certain words in their text using the Doesn't have field.
  • Check Has attachment to find only emails that include attached files.
  • Specify a sent date (or range thereof) using the Date within fields.

Click Search at the bottom of this panel to perform the search using the criteria you've chosen.

You can combine multiple search options 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 (in both the main Gmail window and in the advanced search window), you can use the following operators:

  • subject: — Searches the Subject line.
    • Example: subject:bahamas finds all messages with bahamas in the subject line.
  • from: — Searches for sender name and email address. Partial addresses are OK.
    • Examples: from:heinz finds all messages from heinz@example.com, along with those from your.heinz@example.com. from:me finds all messages you've sent using any Gmail address you've set up.
  • to: — Searches 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: — Searches for 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: — Searches for addresses and names in the Bcc field.
    • Example: bcc:heinz finds all messages that you sent with heinz@example.com in the Bcc field.
  • label: — Searches for messages assigned a label. When using this, replace whitespace characters in label names with hyphens.
    • Example: label:toodoo-doll finds all messages labeled "toodoo doll."
  • has:userlabels — Searches 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 — Searches for messages that have no labels except those that Gmail uses by default.
  • is:starred — Searches for starred messages. You can specify the color of a star or other mark using has:.
    • Examples: has:yellow-star returns messages with a yellow star. has:yellow-bang finds messages with a yellow exclamation mark. has:purple-question searches for messages with a purple question mark. has:orange-guillemet finds messages with two orange forward arrows.has:blue-info returns messages with a blue i.
  • is:unread, is:read, and is:important find messages marked as such for Priority Inbox.
  • has:attachment — Searches for messages that have files attached to them.
  • filename: — Searches within file names of attachments. You can include file name extensions to restrict your search to certain file types.
    • Example: filename:.doc finds all messages with .doc attachments.
  • is:chat — Searches for chat logs.
  • in: — Searches in the folder you specify, such as Drafts, Inbox, Chats, Sent, Spam, and Trash. Anywhere includes the Spam and Trash folders).
    • Example: in:drafts finds all messages in your Drafts folder.
  • after: —Finds messages sent on or after a date, which is typed as YYYY/MM/DD.
    • Example: after:2019/05/05 finds all messages sent or received on or after May 5, 2019.
  • before: — Searches for messages sent before a date.
    • Example: before:2019/05/05 finds all messages sent or received on or before May 4, 2019.
  • larger: (or larger_than:) — Finds emails exceeding a size you specify; bytes is the default measurement; use k for kilobytes and m for megabytes.
    • Example: larger_than:200k finds all messages that exceed 200,000 bytes.
  • size: — Searches 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:) — Searches for messages smaller than the specified size. Specify the size in bytes (no suffix) or using k or m as above.

How to Combine Operators and Search Terms

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:2019/05/05 AND after:2019/05/04 finds all messages sent or received on May 4, 2019.
  • "" — Searches for a phrase (not case-sensitive).
    • 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.
  • + — Searches for a term exactly as typed.
    • Example: +shepherds finds all emails that contain "shepherds" but not those containing just "shepherd."
  • OR — Finds messages containing at least one of two terms or expressions.
    • Examples: shepherd OR macaroni finds messages that contain "shepherd," "macaroni," or both; from:heinz OR label:toodoo-doll finds messages that come from a sender's address that contains "heinz" or are labeled "toodoo doll."
  • - (minus sign/dash) — Returns messages that do not contain a specified term or expression.
    • Examples: -macaroni finds all messages that do not contain the word "macaroni"; shepherd -macaroni finds all messages that contain "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."
  • () (parentheses) — Searches for terms or expressions as a group.
    • 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 with "heinz" in the address and "shepherd" or "macaroni" (or both) in the Subject line, or that appear under the label "toodoo doll."

You can bookmark Gmail searches that you use often.