As your Gmail account accumulates thousands of messages over years of daily communication, relying on basic keyword searches often turns up pages of irrelevant results. When searching for a specific invoice, a contract sent as a PDF, or a confirmation code from two years ago, scrolling through clutter wastes valuable time. Gmail features an extensive library of built-in search operators that allow you to filter your inbox by exact sender, date thresholds, attachment sizes, file extensions, and read statuses.
In this guide, we break down the most essential Gmail search operators, demonstrate how to combine them with Boolean logic, and explain how to turn complex search queries into automated inbox filters.
In This Guide
- Core Gmail Search Operators
- Filtering by Attachments, File Names, and Types
- Finding Large Emails to Reclaim Google Storage
- Searching by Dates and Timeframes
- Combining Multiple Conditions with AND, OR, and Negation
- Filtering by Read Status, Stars, and Labels
- Saving Complex Searches as Automatic Filters
- Quick Reference Query Cheat Sheet
Core Gmail Search Operators
To use search operators in Gmail, simply type them directly into the search bar at the top of the Gmail web interface or mobile app. The foundational operators target sender and recipient fields:
from:[email protected]— Finds all emails sent from a specific address or domain (e.g.from:@github.com).to:[email protected]— Finds emails delivered directly to a designated address.cc:[email protected]— Targets messages where an individual was carbon-copied.subject:"Quarterly Review"— Restricts results exclusively to emails containing that exact phrase in their subject line."exact phrase"— Enclosing any words in double quotes enforces an exact word-order match rather than loose keyword searching.
Filtering by Attachments, File Names, and Types
Locating forgotten documents is one of the most common reasons to search your inbox. Gmail provides granular attachment syntax:
has:attachment— Restricts search results to emails containing at least one file attachment.filename:pdf— Finds messages containing attachments ending in.pdf. This works for any common file extension, such asfilename:xlsx,filename:docx, orfilename:zip.filename:"invoice"— Searches for attachments containing the word “invoice” anywhere in the document’s file name.has:driveorhas:document— Locates emails that link directly to shared Google Drive, Docs, Sheets, or Slides files.has:youtube— Isolates messages containing embedded YouTube video links.
Finding Large Emails to Reclaim Google Storage
Your 15 GB of free Google storage is shared collectively across Gmail, Google Drive, and Google Photos. Outsized email attachments often silently consume gigabytes of quota over time:
size:10Morlarger:10M— Locates all messages exceeding 10 megabytes in total size (including attachments and email body data). You can replace “M” with “K” for kilobytes (e.g.larger:500K).smaller:2M— Finds lightweight emails under 2 megabytes.- Storage Cleanup Query: Typing
has:attachment larger:15Mimmediately identifies the heaviest emails in your mailbox, letting you delete or archive them to recover space.
Searching by Dates and Timeframes
Gmail handles relative and absolute date filtering effortlessly using standard formatting (YYYY/MM/DD):
after:2025/01/01— Shows messages received on or after 1 January 2025.before:2024/06/30— Shows messages received prior to 30 June 2024.older_than:1y— Finds emails older than one year. You can usedfor days,mfor months, andyfor years (e.g.older_than:6m).newer_than:7d— Displays emails received within the last seven days.
Combining Multiple Conditions with AND, OR, and Negation
You can create sophisticated queries by stringing operators together using standard logical syntax:
- Implicit AND: By default, separating search terms with a space requires both conditions to match. For example:
from:accounting filename:pdf has:attachment. - OR Logic: Use capitalised
OR(or curly brackets{}) to match either criterion:
orfrom:sarah OR from:david{from:sarah from:david} - Negation (Minus Sign): Prepending a hyphen or minus sign (
-) excludes specific terms or folders:
(Finds messages with attachments that are NOT PDF files.)has:attachment -filename:pdf
(Finds support tickets where the word “resolved” is absent.)from:support -subject:resolved - Grouping (Parentheses): Use round brackets to group terms together:
from:bank (statement OR invoice) larger:2M
Filtering by Read Status, Stars, and Labels
To triage unmanaged messages or find specific flagged items:
is:unread— Displays only unread messages. Combine within:inboxto clean your current inbox view:in:inbox is:unread.is:starred— Shows all messages marked with a star.is:important— Filters by Gmail’s algorithmic priority tag.label:work— Shows emails filed under the custom label “work”. For nested labels, use forward slashes:label:projects/client-alpha.is:snoozed— Reveals messages currently hidden on snooze.in:trashorin:spam— Searches within folders normally excluded from universal Gmail searches.
Saving Complex Searches as Automatic Filters
Once you compose an effective search query, you can convert it into an automated filter so incoming mail is processed automatically:
- Type your query into the Gmail search box.
- Click the Show search options icon (the slider icon on the far right of the search bar).
- Your query parameters will populate the advanced search fields automatically.
- Click the Create filter button at the bottom of the dialogue window.
- Choose the actions Gmail should execute automatically when matching emails arrive—such as applying a custom label, skipping the inbox, marking as read, or starring.
- Click Create filter to confirm.
Quick Reference Query Cheat Sheet
| Search Intent | Example Syntax |
|---|---|
| Unread emails from a client | from:[email protected] is:unread in:inbox |
| Spreadsheets over 5MB | filename:xlsx larger:5M |
| Old newsletters for bulk purge | unsubscribe older_than:1y -is:starred |
| Receipts with PDF attachments | subject:(receipt OR invoice) filename:pdf |
| Urgent chats or meetings | is:chat after:2026/01/01 "reschedule" |