Small Business Stack

Find Large Attachments and Old Mail with Gmail Search Operators

How do I find the large attachments and old emails that are filling up my Gmail storage?

Type larger:10M into the Gmail search box to list every message over 10 MB, then narrow it with older_than:1y, has:attachment, filename:pdf or -is:starred. Review the results before you delete anything. Deleted mail sits in Trash for up to 30 days and still counts toward storage until it leaves Trash.

larger:10M older_than:1y -is:starred

What you need

  • A Gmail account in a web browser
  • A rough idea of which mail is safe to remove, such as old newsletters or duplicate file sends
  • A place to save attachments you want to keep before deleting the email

How this script runs

  1. Search for the biggest messages with larger:
  2. Narrow by age, file type or sender
  3. Exclude starred conversations
  4. Open a sample and check nothing is still needed
  5. Delete, then empty Trash only when sure

When a Gmail account runs short of space, a few very large messages usually do more damage than thousands of small ones. Type larger:10M into the Gmail search box to see every message over 10 MB, then narrow the list by age, file type or sender. Google lists all of these operators on its Refine searches in Gmail help page.

Gmail storage is shared. Google’s storage help page says the free 15 GB on a personal account is split across Gmail, Google Drive and Google Photos, and that Gmail’s share includes the Spam and Trash folders. When the account hits its limit, Google says Gmail can stop sending and receiving mail. For a small company running on personal accounts, that can mean a shared inbox goes quiet without much warning.

Which Gmail operators narrow a search to the mail that takes up space?

These operators do most of the work. Each one goes in the normal Gmail search box, and you can combine several in one search by separating them with spaces.

Operator What it matches Example from Google’s list
larger: Messages over a given size larger:10M
size: / smaller: Messages by size size:1000000
has:attachment Messages with an attachment has:attachment
filename: Attachments with a name or file type filename:pdf
older_than: / newer_than: Older or newer than a period in d, m or y older_than:1y
before: / after: Received before or after a date before:2004/04/18
- (minus) Leaves out anything that matches the next term dinner -movie
is:starred Starred messages is:starred
category: An inbox category, if you use them category:promotions
list: Mail from a mailing list list:info@example.com
in:anywhere All of Gmail, including Spam and Trash in:anywhere movie

A few details from the same page matter here. Google’s size example uses an M suffix for megabytes, and that is the form to stick with. The page shows smaller: without an example, so treat any other unit as something to test on your own mail. Dates for before: and after: can be written as 2004/04/16 or 04/16/2004. For older_than: the units are days, months and years only, so a search for mail older than two weeks becomes older_than:14d.

Ready-to-paste searches for old and oversized mail

Copy one line at a time into the Gmail search box. Each line is a separate search.

larger:10M
larger:5M older_than:1y
larger:5M older_than:1y -is:starred
has:attachment before:2024/01/01 -is:starred
filename:pdf larger:5M
filename:zip larger:5M
filename:mov older_than:6m
category:promotions older_than:1y
list:info@example.com older_than:6m
in:anywhere larger:10M

What each search is good for:

Search Typical use
larger:10M The biggest single messages anywhere in the mailbox
larger:5M older_than:1y Large mail nobody has touched in a year
larger:5M older_than:1y -is:starred The same list, minus anything someone starred to keep
has:attachment before:2024/01/01 -is:starred Every older attachment, as a list to skim
filename:pdf larger:5M Scanned contracts, catalogues and long reports
filename:zip larger:5M Archives sent around once and never opened again
filename:mov older_than:6m Phone videos sent by email
category:promotions older_than:1y Old marketing mail, if inbox categories are on
list:info@example.com older_than:6m One mailing list you no longer read; swap in the real list address
in:anywhere larger:10M Large mail that has already gone to Spam or Trash

Start with larger:10M. If that returns only a handful of messages, step down to larger:5M and then larger:2M. A lower threshold catches more mail but makes each result less likely to matter, so stop once the list stops turning up anything worth removing.

The list: example uses a placeholder address. To find the right list address, open one newsletter and look at the sender details, then use that address in the search.

How should I review the results before deleting anything?

Treat every search as a shortlist, not a delete list. The searches match by size, date and type, and none of them knows whether a message is a signed contract or a duplicate brochure.

  1. Run the search and read the first page of results. Check the senders and subjects. If you see invoices, payroll files, signed agreements or anything a client sent, add terms to leave them out, such as -from:accounts@example.com, before going further.
  2. Open a few messages from the middle and end of the list. Problems tend to hide there rather than at the top.
  3. Save what you need before deleting the email. Download attachments that must be kept to your computer or a company file store. Saving them to Google Drive in the same account does not free space, because Drive and Gmail draw on the same storage. If you keep shared files in Drive, the guide on finding same-name files in a Google Drive folder without deleting anything helps tidy that side too.
  4. Delete in small groups. A search like larger:10M older_than:2y -is:starred usually returns a short, easy-to-check list. Clear that, then widen the search.

Be careful with -is:starred. Google’s operator page warns that negative operators work on messages, not whole conversations. A search for -is:starred can return an entire conversation if at least one message in it is unstarred, even when another message in the same conversation is starred. Before you delete a conversation from these results, open it and check for a star.

For company mailboxes, agree on rules first. Some records, such as tax or employment documents, may need to be kept for a set period. Check with your accountant or adviser before clearing anything from a finance or HR inbox.

What happens to deleted mail, and when does the space come back?

Deleting a message in Gmail moves it to Trash. Google’s Delete messages in Gmail page says the message can be recovered from Trash for up to 30 days, and after 30 days it is permanently deleted and cannot be recovered.

That 30-day window is useful protection, but it has a cost. Messages in Trash and Spam still count against storage. Google’s storage management page calls emptying Trash and Spam the quickest way to recover space, and notes that the storage figure can take time to update after you delete a lot at once. If the account is already at its limit, you may need to empty Trash rather than wait for the 30 days to pass.

A sensible order:

  • Delete the reviewed results.
  • Wait a day or two in case someone asks for something back.
  • Search in:anywhere larger:10M to confirm the large items are now only in Trash.
  • Empty Trash once you are sure, then check the storage figure again later.

Archiving is not the same as deleting. An archived message leaves the inbox but stays in the account and keeps using storage. Archiving helps when the problem is a cluttered inbox, but it does nothing for a storage warning.

When do these searches fall short?

Gmail search finds mail; it does not total up sizes or report a ranked list. If you need to see exactly how much each sender or year uses, or you manage many mailboxes, a tool built to report mailbox sizes will serve better than repeated manual searches. Workspace administrators should check what their admin tools offer.

A few other limits are worth knowing:

  • Shared inboxes and delegated accounts. Agree who deletes what. One person clearing old attachments can remove files a colleague still relies on.
  • Mail you must keep for legal or tax reasons. Exclude it with -label: or -from: terms, or leave that mailbox to whoever owns the retention rules.
  • The problem is in Drive or Photos. If large messages are few and storage is still full, the space is probably elsewhere in the account.
  • Repeat cleanups. If the same newsletters pile up every month, filters or a scheduled script make more sense than manual searches.

If you use Gmail with Google Forms or Sheets, related guides cover creating Gmail reply drafts from Google Forms responses and sending one daily task reminder from Google Sheets. More guides on the tools a small company runs on are collected under the small business stack topic.

Sources

Free, from Producfy

Get the next guide before you need it

One email when a new guide or tool goes up: working formulas, queries and scripts for spreadsheets, SQL and the CRM and billing exports that end up in them. At most one a week.

Esc