# Gmail Cleanup Query Builder — Zen Inbox Cleaner

Last reviewed: August 30, 2026. HTML version: https://zeninboxcleaner.com/tools/gmail-cleanup-query-builder

Tick what you want to find. Get the exact Gmail search to paste into the search box — the honest, manual way to hunt down clutter.

The builder runs entirely in your browser: nothing you type is sent anywhere, there is no form submission, no cookie, and nothing stored. This mirror lists every operator it can produce, so you can write the same search by hand without running the tool.

## What you pick

- **Bigger than** — 5 MB · 10 MB · 25 MB → `larger:10M`
- **Older than** — 6 months · 1 year · 2 years · 3 years → `older_than:1y`
- **Gmail category** (one at a time) — promotions · social · updates · forums → `category:promotions`
- **Has an attachment** → `has:attachment`
- **Attachment type** — PDF · ZIP · MP4, or none for any file type → `filename:pdf`
- **From sender** — an address, a domain, or a name — wrapped in quotes automatically when it contains spaces (`from:"John Smith"`) → `from:newsletter@example.com`
- **Only unread** → `is:unread`
- **Include Spam & Trash** → `in:anywhere` (careful: this includes Spam and Trash — check what you're deleting)

The parts are joined with single spaces, always in that order, and every condition has to match.

## The operators, with Gmail's documented meaning

Nothing here is invented. These are Gmail's own search operators, as documented in Gmail's own search-operator reference: https://support.google.com/mail/answer/7190

| Operator | What it finds | Example |
|---|---|---|
| `larger:` | Find emails by their size. | `larger:10M` |
| `older_than:` / `newer_than:` | Find emails older or newer than a period of time, using `d` for day, `m` for month and `y` for year. | `older_than:1y` |
| `before:` / `after:` | Find emails sent before or after a specific date. | `after:2004/04/16` |
| `has:attachment` | Find emails that have an attachment. | `has:attachment` |
| `filename:` | Find emails that have attachments with a certain name or file type. | `filename:pdf` |
| `category:` | Find emails in one of Gmail's categories. Documented values: `primary`, `social`, `promotions`, `updates`, `forums`, `reservations`, `purchases`. | `category:promotions` |
| `from:` | Find emails from a specific sender. | `from:newsletter@example.com` |
| `is:unread` | Find emails that are unread. | `is:unread` |
| `in:anywhere` | Search for emails across all of Gmail — this includes emails in Spam and Trash. | `in:anywhere` |

There is **no unsubscribe operator**. Gmail's search can find the mail a sender keeps sending you; it cannot stop the sending.

## Two worked examples

- `category:promotions older_than:1y` — a year and more of marketing mail you have already ignored once. Read it as: messages Gmail filed under Promotions, and older than one year.
- `has:attachment larger:10M older_than:2y` — the heavy old messages: anything with an attachment, over 10 MB, older than two years. Email storage lives mostly in attachments, so a hundred of these can outweigh ten thousand newsletters.

Gmail does not care what order the operators come in — the same conditions find the same mail either way — so the builder always writes them in one fixed order (size, age, category, attachment, attachment type, sender, unread, scope) to keep the string stable.

To run either one, paste it into Gmail's search box. The tool can also open the search for you: it appends the URL-encoded query to `https://mail.google.com/mail/u/0/#search/`.

## Search finds — it never deletes

You still review and delete yourself. Deleted mail moves to Gmail's Trash, and the storage frees only after Trash clears — 30 days, or empty it now. Details: https://zeninboxcleaner.com/answers/does-deleting-emails-free-up-storage

Not sure email is your storage problem at all? Start with the one-minute diagnosis: https://zeninboxcleaner.com/tools/storage-diagnoser

## Or do it in taps instead of queries.

Zen Inbox Cleaner groups your Gmail inbox by sender, so you can trash bulk mail, newsletters, and promotions in one tap — and unsubscribe with one tap. It reads email metadata only (never bodies or attachments), everything happens on your device, and nothing is permanently deleted by the app — trashed email stays recoverable in Gmail's Trash for 30 days.

Get the app: https://zeninboxcleaner.com/#get · How it works: https://zeninboxcleaner.com/#how-it-works
