Skip to content
MailSlurp logo

Email file size limits: attachments, Gmail, and MIME overhead

Find the attachment limit that applies to your Gmail account, distinguish it from total message size, and measure MIME overhead before sending.

Use with your tools

The largest file you can email depends on both the sender's limits and the recipient's limits. It also depends on what the limit measures: an attachment's original bytes and the complete encoded email are different sizes.

If you are attaching a file manually, check the account's attachment cap first. If your application builds the email, also measure the MIME message it produces. A file below one limit can still produce an email above another.

Quick answer

There is no universal maximum file size for email. Personal Gmail accounts allow up to 25 MB of attachments in total; Workspace limits depend on the edition and administrator settings. The recipient's system can impose a lower limit.

For a total-message cap, include the body, headers, attachments and encoding overhead. A base64 attachment alone grows by roughly a third before line breaks and other MIME content are counted. Use a controlled download link when the required file will not fit, and check that the recipient can access it.

Gmail size limits in practice

Google's attachment help distinguishes personal Gmail's 25 MB attachment limit from work and school accounts, where administrators set sending and receiving limits. When total attachments exceed the permitted size, Gmail can replace them with a Google Drive link.

Google Workspace Enterprise Plus has a higher configurable ceiling: Google announced support for up to 50 MB of outgoing attached files and 70 MB for the total incoming message. Those are different measurements; 70 MB is not a promise that a 70 MB file can be attached and received. The feature is controlled by the administrator. See Google's Enterprise Plus announcement.

The Workspace edition comparison also separates attachment limits by edition. Confirm the enabled limit for the sending account and the receiving account before relying on a maximum. A larger receiving allowance does not imply the same allowance for sending or forwarding.

What counts toward email size

An attachment cap usually refers to the attached files under the provider's stated rules. A total-message cap covers the serialized email, which can include:

  • text and HTML bodies;
  • embedded images and file attachments;
  • MIME part headers, boundaries and transfer encoding;
  • message headers and content added by a sender or gateway.

A remotely hosted image is not embedded as file bytes in the MIME message, although its URL and HTML markup are. The recipient still has to download that image to display it. Replacing an embedded image with a URL changes message size and loading behavior, so test both.

Why attachments get bigger in transit

Base64 represents each three input bytes using four characters, with padding for the final partial group. Its encoded character count is 4 * ceil(file_bytes / 3). MIME base64 also wraps lines at no more than 76 characters. RFC 2045 defines the encoding and wrapping rules.

That means multiplying a file size by 1.33 is only an estimate of the encoded data, not a measurement of the complete email. Line breaks, the message body, attachment metadata and other headers add more bytes. Multiple attachments contribute to the same message total.

For example, a 10,000,000-byte file becomes 13,333,336 base64 characters before those additions. An attachment allowance of 10 MB and a total encoded-message allowance of 10 MB therefore describe different limits.

Measure a complete MIME message in Python

Let's build an example email containing a 10 MB generated attachment. This example uses only Python's standard library and does not read a file or send a message. The attachment is deliberately simple so you can see encoding overhead separately from file contents.

Save it as message-size.py and run python3 message-size.py. The SMTP email policy serializes with SMTP-style line endings; len(serialized) counts the resulting bytes.

from email.message import EmailMessage
from email.policy import SMTP


def build_message(file_bytes):
    message = EmailMessage(policy=SMTP)
    message["From"] = "sender@example.com"
    message["To"] = "recipient@example.com"
    message["Subject"] = "Attachment size example"
    message.set_content("The attachment contains generated example bytes.")
    message.add_attachment(
        file_bytes,
        maintype="application",
        subtype="octet-stream",
        filename="example.bin",
        cte="base64",
    )
    message.set_boundary("=_attachment_size_example")
    return message.as_bytes(policy=SMTP)


if __name__ == "__main__":
    attachment = b"x" * 10_000_000
    serialized = build_message(attachment)
    for label, count in (
        ("File", len(attachment)),
        ("MIME message", len(serialized)),
    ):
        print(f"{label}: {count:,} bytes ({count / 1_000_000:.3f} MB; "
              f"{count / 1_048_576:.3f} MiB)")

For this message, the output is:

File: 10,000,000 bytes (10.000 MB; 9.537 MiB)
MIME message: 13,684,765 bytes (13.685 MB; 13.051 MiB)

The output reports decimal MB and binary MiB so the unit is explicit. Use the provider's own definition when comparing a limit. If you change the headers, body or attachment, measure the serialized result again.

Your sending service may re-encode the message or add headers and signatures, changing its size again. For your application, measure the output of its actual mail library and inspect a received test copy as well.

Repeated attachment checks also need a destination that tests can inspect. MailSlurp provides inboxes and attachment APIs for capturing the email your application sends and checking its files programmatically.

Practical size rules by workflow

Transactional emails

For an invoice or receipt, keep the required document and remove duplicate images or unnecessary attachments. Serialize the final template with representative data, including the largest supported document, instead of sizing an empty template.

Marketing emails

Optimize images and avoid embedding large assets when a hosted image suits the campaign. Treat HTML clipping and visual rendering as separate checks: reducing an attachment does not by itself establish that the email body displays correctly. Use email client testing to inspect that result.

File-heavy workflows

For files that exceed the allowed size, send a controlled download link. Test the recipient's permissions, any expiry, and access without the sender's logged-in session. Compression is useful only if the resulting file becomes smaller and the recipient can open the format; measure the compressed output before deciding it fits.

How to test large-email workflows

A size check answers whether the message fits a particular limit. It does not establish that a file type is permitted, that the receiving mailbox has space, or that the recipient can open the document.

Use a controlled test for each important attachment workflow:

  1. Measure the final message. Include the actual body and every attachment. Compare original file bytes and encoded message bytes with the limits that apply to each.
  2. Check the send result. Record whether the sending service accepted the message. If it rejects it, inspect the stated reason rather than assuming every attachment failure is about size.
  3. Check receipt and contents. Wait for the intended message in a MailSlurp inbox. Check attachment count, filenames and content types, then download and compare the decoded bytes with the originals. The attachment API guide explains the upload and download operations.
  4. Check the recipient's task. Open the document or follow the download link in the environment you support. Test the email's appearance separately where layout matters.

A successful MailSlurp receipt verifies that test path. It does not establish the attachment cap of every recipient provider or guarantee inbox placement elsewhere. Include the providers and account configurations your application must support in the broader test plan.

FAQ

What is the email size limit?

It varies by service, account configuration and direction. First identify whether the published limit counts original attachments or the whole encoded message, then check both the sender and recipient.

What is Gmail's attachment size limit?

Personal Gmail allows 25 MB of total attachments. Workspace limits depend on the edition and administrator settings; Enterprise Plus can permit up to 50 MB of outgoing attachments. Its higher incoming total-message limit is a separate measurement.

Why does an attachment fail even when the file looks smaller than the limit?

A total-message limit includes encoding and other content, so the email can exceed it even when the original file does not. File-type restrictions and recipient settings can also cause rejection; read the actual failure response.

Should I attach a file close to the provider limit?

Only after checking what that limit counts and measuring the completed message. Leave room for content added by the sending path, or use a download link when you cannot keep the message within the required limits.