This article describes limits that Gmail enforces for email message headers, and provides recommended actions to help keep headers within these limits. Message headers that stay within the limits helps ensure correct message delivery.
Email headers provide information, or metadata, about the message. For example, email headers contain information about the sender, recipient, and the time the message was sent.
To protect people in your organization from malicious, spam or phishing emails, Gmail blocks messages containing headers that exceed the limits described here. Spammers and other malicious senders can use large headers in messages to impersonate legitimate senders, or to bypass spam rules.
Sometimes, legitimate, non-malicious messages contain very large headers. This typically happens with devices or systems that send automated email messages. Some other causes of very large message headers are custom headers and large Subject: headers. For example, adding message content to the Subject: header can cause the Subject: header to exceed the allowed limit for individual headers.
Header limit errors
When Gmail blocks a message with headers that exceed a limit, Gmail returns an SMTP error message to the sender. The message describes the limit that was exceeded. Review example error messages and recommended actions for each in Troubleshoot message header errors, below.
To review all Gmail SMTP error messages, visit Gmail SMTP errors and codes.
Gmail message header limits
To help ensure correct message delivery, keep message headers within these limits. These limits also apply to incoming messages.
Description | Maximum value |
---|---|
All headers in a single message | 500KB |
Number of headers per message | 5000 |
Any single header |
32KB (value after the colon) This limit doesn’t apply to these header types: Cc:, To:, References:. However, these header types are counted toward the total for all headers in a single message. |
Message-ID: header | 500 characters (characters after the colon) |
Subject: header | 998 characters (characters after the colon) |
Header name |
1KB (before the colon) Header types that exceed this limit are typically custom headers, which have an “X" prefix, for example: X-My-Custom-Header:. Maximum allowed value after the colon is 32KB. |
Troubleshoot message header errors
If outgoing messages are rejected because message headers exceed Gmail’s message header limits, we recommend taking these actions:
- Truncate the header values
- Move header information to the message body
The values shown in the error messages below are example values and will be different in the error messages you get.
Error message | Description & recommended actions |
---|---|
552-5.3.4 Your message exceeded Google's message header size limits. Messages must not exceed 512000 total header bytes or 5000 header fields. Please visit https://google-support.mirrorblogs.com/a?p=header-limits to view our size guidelines. |
The message includes a header that exceeds the maximum value allowed for Number of headers per message or for Total for all headers in a single message. To fix this issue, move some information from message headers to the message body. |
552-5.3.4 The size of the standard-header-type header value (32769 bytes) exceeds Google's limit of 32768 bytes per individual header size. Please visit https://google-support.mirrorblogs.com/a?p=header-limits to view our size guidelines. |
A standard header exceeds the maximum allowed for any single header: 32KB. The error message indicates which header is too long. To fix this issue, truncate this header when new messages are created. If you can’t easily truncate this header, move some information from the header to the message body. |
552-5.3.4 The size of one of the headers value (32769 bytes) exceeds Google's limit of 32768 bytes per individual header size. Please visit https://google-support.mirrorblogs.com/a?p=header-limits to view our size guidelines. |
A non-standard header exceeds the maximum allowed for any single header: 32KB. To protect potentially sensitive information, we don’t include the custom header name in the error message. To fix this issue, identify the header causing the error and truncate that header when creating new messages. |
552-5.3.4 The size of a header name (1001 bytes) exceeds Google’s header name limit of 1000 bytes. Please visit https://google-support.mirrorblogs.com/a?p=header-limits to view our size guidelines. |
The message contains a header with a name that exceeds the maximum allowed for header names (before the colon). Header types that exceed this limit are typically custom headers. So, to fix this issue, update custom headers to meet the maximum value allowed. |