How to Use Search Operators to Find Emails in Gmail

Find exactly what you need with these tips and tricks

Gmail's advanced search capabilities help you find precisely what you're looking for fast using search operators. Search operators are special characters and parameters that fine-tune a search. Gmail's robust search features are handy, given the vast amount of storage Gmail offers. A manual search through your archived emails would be nearly impossible otherwise.

When a simple text entry in the search field at the top of the Gmail screen returns too many emails, use these operators to search by subject line, date range, sender, and more.

The instructions in this article are designed to be used with the desktop version of Gmail, accessed through any web browser.

Simple Searches

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

Gmail main screen

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

Gmail Search Options

When a simple search yields too many results or not those you need, specify criteria to narrow the results. Click the Show search options drop-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 the 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 chose.

Combine multiple search options to find, for example, emails from a certain sender that contain attachments and that 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. For example, subject:bahamas finds all messages with bahamas in the subject line.
  • from: searches for sender name and email address. Partial addresses are OK. For example, from:heinz finds all messages from heinz@example.com, along with those from your.heinz@example.com. For example, from:me finds all messages you sent using any Gmail address you set up.
  • to: searches the To line for names and addresses. For 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. For 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. For 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. For example, label:toodoo-doll finds all messages labeled toodoo doll.
  • has:userlabels searches for emails that have any labels except those used by default (those that don't include 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:. For example, 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, and 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. For 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. For 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. For 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. For 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. For example, larger_than:200k finds all messages that exceed 200,000 bytes.
  • size: searches for messages exceeding the given size in bytes. For 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 use k or m as above.
  • deliveredto: searches for emails with the specified email address in a Delivered-To header line.

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. For example, 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). For example. "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. For example, +shepherds finds all emails that contain shepherds but not those containing only shepherd.
  • OR finds messages containing at least one of two terms or expressions. For example, 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. For example, -macaroni finds all messages that do not contain the word macaroni, shepherd -macaroni finds all messages that contain shepherd but not macaroni, and 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. For example, subject:(shepherd macaroni) finds messages that have both shepherd and macaroni somewhere in the Subject line (but not necessarily as a phrase), and 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.

Was this page helpful?