DEV Community

TiltedLunar123
TiltedLunar123

Posted on

Gmail search can't tell you how big an email is, so every exact storage number is a guess

Gmail will not tell you how big an email is. It will only tell you one thing: whether that email is bigger than a number you picked.

That sounds like a small distinction. It is not, because it is the reason that every "you can free up 2.3 GB" figure you have ever seen in a mail cleanup tool is really a guess wearing a decimal point.

The search index answers yes or no

Gmail search gives you size operators. larger:10M and smaller:5M both work, and so does size:1000000 if you would rather think in bytes (most people never touch any of them, which is a shame, because they are genuinely useful).

But look at what comes back. A list of messages. That is it. Not one of them carries a size anywhere in the result row. You asked a threshold question, so you got a threshold answer: these are the ones over your line, and that is all.

So if larger:10M returns 40 messages, what do you actually know? Only that those 40 messages account for at least 400 MB between them. The real figure could be 400 MB; it could just as easily be 3 GB, if a handful of them turn out to be 200 MB video attachments. Search will not tell you which, because you did not ask a question that it can answer that precisely.

So what do you report instead?

Once you accept that, the honest unit changes. Not totals. Floors.

"At least 400 MB" is a true statement that you can act on. "You will free 437 MB" is a number somebody made up, by picking a plausible average and then multiplying by it. The average is doing all of the work there, and nobody ever tells you which average they used.

I care about this because I maintain a Gmail cleanup extension, and it was very tempting to print the nicer number. Precise figures feel more trustworthy, though they are also the easiest thing in the whole product to be quietly wrong about. And you would never find out, because you cannot check Gmail's arithmetic either.

Walking the tiers without double counting

Here is the part worth stealing regardless of what tool you use. You can get a much better floor by walking down in tiers instead of asking one question:

larger:25M
larger:10M -larger:25M
larger:5M -larger:10M
Enter fullscreen mode Exit fullscreen mode

The negation is the whole trick. Every message over 25 MB also matches larger:10M, and larger:5M as well, so three plain searches would count your very worst offenders three times over and hand you a wildly inflated total. Excluding the tier above means that each message lands in exactly one bucket.

Now the floor gets tighter. Everything in bucket one is worth at least 25 MB; everything in bucket two, at least 10 MB; and so on down the list. Multiply each count by its tier and total it up; what you have at the end is a defensible minimum rather than a vibe.

But who is actually doing this to you?

Counts are interesting; names are actionable. So bolt a sender onto each tier:

larger:5M -larger:10M from:reports@somevendor.com```

Run that across your top few senders and the picture usually resolves fast. It is rarely a thousand small things; it is one automated report with a PDF attached, arriving every Monday for four years, or a family member who sends photos as attachments instead of links.

Two caveats worth naming, because they bite people. Ready?

Deleting does not free anything until Trash empties, which Gmail does on its own after about 30 days. And the quota you are fighting is not Gmail's at all, although it looks like it is, because it belongs to your Google Account and is shared with Drive and Photos. Clearing 2 GB of mail while Photos quietly grows is a treadmill.

## If you would rather not run the searches by hand

The tier walk is a handful of searches and a bit of multiplication, so doing it by hand is completely reasonable. I automated it because I got tired of retyping the negations, and because attributing each tier by sender gets tedious past about five senders (which is roughly where it stops being fun and starts being data entry).

That became the Storage X-ray in Gmail One-Click Cleaner, which is free to scan and reports every figure as an "at least", for exactly the reason above. Full disclosure, it is mine: https://chromewebstore.google.com/detail/bmcfpljakkpcbinhgiahncpcbhmihgpc

Either way, the useful idea is free. When a tool quotes you a precise storage number pulled from Gmail search, ask where the precision came from. Search did not hand it to them.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)