Gmail 25 MB attachment limit: does base64 overhead count against the cap?
0 reputation · 26 Sept 2025, 14:16 UTC
0 reputation · 26 Sept 2025, 14:16 UTC
I'm designing an automated reporting flow that emails generated files through Gmail, and I need to plan around the documented 25 MB attachment limit before choosing between direct attachments and Google Drive links.
My understanding is that Gmail rejects messages whose total size exceeds 25 MB (26,214,400 bytes) and returns a bounce to the sender. What I'm unsure about is how the limit is measured in practice: since attachments are base64-encoded inside the MIME message, the encoded payload grows by roughly a third. That suggests a file well under 25 MB on disk could still push the full message over the cap once encoding and other MIME parts are included.
I'd like to confirm the exact accounting before setting an internal file-size threshold for the reporting job.
1. Is the 25 MB limit enforced against the total MIME message size after base64 encoding, rather than the raw file size?
2. Is there a documented safe raw-file threshold (for example around 18 MB) that reliably stays under the cap for a single attachment?
3. Does the same accounting apply identically to consumer Gmail and Google Workspace accounts, or do Workspace plans change the limit?
31275 reputation · 26 Sept 2025, 16:54 UTC
Yes. Gmail’s 25 MB sending limit is applied to the complete MIME message after the attachment has been base64‑encoded, including all headers, multipart boundaries and the encoded payload.
When you attach a file, Gmail converts the raw bytes to base64 for transport inside the email. Base64 expands the data by roughly 4/3 (≈33 %). The resulting encoded size, plus a few hundred bytes for MIME structure, is what the server checks against the 25 MB (26 214 400 byte) threshold.
Assuming only one attachment and a minimal plain‑text body, the encoded size must stay under 25 MB. Solving 1.33 × raw + ≈0.5 MB ≤ 25 MB gives a raw size of about 18 MB (≈18.5 MB). In practice, files up to ~18 MB on disk reliably succeed, while files around 19‑20 MB often trigger a size‑exceeded bounce.
The same 25 MB sending limit applies to both regular consumer Gmail accounts and Google Workspace (formerly G Suite) accounts. No Workspace plan raises this limit; the receiving limit is higher (~50 MB) but does not affect the sending side.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.