How long can an email address be? The question sounds trivial until a signup fails for one customer with a long corporate address, or a database silently truncates an address and mail goes to the wrong person. The standards set clear limits, but they are spread across several documents and are often misquoted. A single number worth remembering is 254, and it is not the one found in the first place most people look.
This article lays out the limits for each part of an address, explains where they come from, shows how to size database columns and form fields, and describes what goes wrong when you get them wrong.
The limits at a glance
| Element | Limit | Source and notes |
|---|---|---|
| Local part (before @) | 64 octets | Set in the SMTP specification |
| Domain name as text | 253 characters (255 octets in wire format) | DNS limit on a full name |
| Each domain label (between dots) | 63 octets | DNS limit |
| Complete forward path in SMTP (including angle brackets) | 256 octets | SMTP limit for the path in RCPT TO and MAIL FROM |
| Complete email address | 254 characters | 256 minus the two angle brackets; the figure confirmed in later errata and widely used |
| Number of recipients per message | At least 100 must be accepted by servers | Servers may accept more or enforce lower limits. See too many recipients |
| Header line | 998 characters maximum, 78 recommended | Applies to the whole header. See SMTP line length |
The numbers refer to octets, not visible characters. For ASCII text the two are equal. With international characters in an address, one visible character can take several octets, which means the effective limit in characters is lower.
Where the 254 figure comes from
The SMTP specification says the maximum total length of a reverse-path or forward-path is 256 octets, including the punctuation (the angle brackets) that surrounds an address in the commands. Removing those two characters leaves 254 for the address itself. Older documents and some libraries quote 255 or 320, the latter by adding 64 + 1 + 255. That sum is a theoretical combination of the two parts and is not a valid length, because the whole path is capped lower. Treat 254 as the practical maximum.
A worked example
local part: a-very-long-mailbox-name@ (up to 64 characters)
domain: division.department.example-company.com (labels up to 63 each)
Full address must be: 254 characters or fewer.
Example check:
len(local) <= 64
every label in domain <= 63
len(domain) <= 253
len(local) + 1 + len(domain) <= 254What real addresses look like
Most real addresses are short, often under thirty characters. Long ones usually come from one of a few sources: automatically generated mailbox names for system accounts, plus-addressed tags that include order or campaign identifiers, department-based addresses at large institutions, and test data created by developers or security tools. Treat unusually long input with care. It can be legitimate, but it can also be an attempt to overflow a field, probe validation or generate junk.
How to size database columns
| Choice | Recommendation |
|---|---|
| Column type | VARCHAR(254) is sufficient for the address; some teams use 255 to leave a margin |
| Character set | Use a Unicode-capable set so international addresses are stored correctly |
| Index | Index the normalised comparison column. A unique index on a long string is fine at 254 characters, but watch key-length limits in your engine |
| Separate fields | Store the address as one value; do not split local part and domain unless you need domain statistics |
| Display name | Store separately and with a larger field (for example 255 or more) |
| Primary keys | Do not use the address as a primary key; use a surrogate id so the address can change |
CREATE TABLE contacts (
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(254) NOT NULL,
email_norm VARCHAR(254) AS (LOWER(email)) STORED,
created_at DATETIME NOT NULL,
UNIQUE KEY uq_contacts_email_norm (email_norm)
) DEFAULT CHARSET=utf8mb4;With a multibyte character set, some older MySQL index configurations limit the indexed length in bytes, so test your schema with maximum-length data. See case handling for related normalisation choices.
Validation rules for forms and APIs
- Trim first, then measure.
- Reject empty input and addresses without exactly one separating @ (the local part can contain a quoted @ only in rare cases; most public forms can reject it).
- Check the local part is 1 to 64 octets.
- Check each domain label is 1 to 63 octets and that the whole domain is at most 253 characters.
- Check the total is at most 254.
- Use a field maxlength of 254 in the browser as a convenience, and enforce the limit on the server as the real control.
- Return a clear error that says what is wrong without exposing internals.
- Never truncate to fit a field; reject instead. A truncated address is a different, possibly real, address.
function validEmailLength(string $e): bool {
if (strlen($e) > 254) return false;
$parts = explode('@', $e);
if (count($parts) !== 2) return false;
[$local, $domain] = $parts;
if ($local === '' || strlen($local) > 64) return false;
if ($domain === '' || strlen($domain) > 253) return false;
foreach (explode('.', $domain) as $label) {
if ($label === '' || strlen($label) > 63) return false;
}
return true;
}What goes wrong when the limit is ignored
| Failure | Cause | Impact |
|---|---|---|
| Silent truncation | Field narrower than the address (for example VARCHAR(50)) | Mail goes to a different, possibly real person; privacy incident |
| Signup rejected | Overly strict client-side length check | Lost customers with legitimately long addresses |
| Receiving server rejection | Address longer than the server accepts | Bounce with a syntax or recipient error. See 501 and 503 errors |
| Index errors on import | Key length exceeded for the engine | Import aborts midway |
| Log or report truncation | Narrow columns in analytics | Matching events to contacts fails |
| Injection attempts | Very long or malformed input used to probe a form | Mitigate with strict validation. See header injection |
Related limits worth knowing
- Subject line. The practical limit is far below the technical line limit; see ideal email length for guidance on content.
- Message size. Providers cap total size. See size limits and attachments.
- Display names. No hard limit, but long names are truncated in clients. See sender name.
- DNS TXT strings. Records for authentication have their own length quirks. See TXT length and quirks.
- SMS. If you also text customers, see SMS character limits.
Why shorter is better
Even though 254 characters are allowed, shorter addresses are more reliable. They are easier to type on a phone, less likely to wrap in a template, simpler to read aloud and less likely to be mistyped. For your own senders, choose a clear, short mailbox name on a short domain, for example [email protected] instead of a long department path. See choosing the domain name for guidance.
Testing checklist
- Test addresses at exactly 64 characters in the local part and one more.
- Test a domain label at 63 characters and one more.
- Test a total of 254 and 255 characters.
- Test an address with multibyte characters and check storage and display.
- Confirm that rejected input is not stored anywhere.
- Check that log and report tables accept the full width.
- Send a message to a maximum-length address in a controlled environment and confirm the envelope is intact.
The length rules are simple once you separate the three layers: 64 for the local part, 63 for each domain label and 254 for the whole address. Size your storage for 254, validate all three limits on the server, reject rather than truncate, and remember that a shorter address is easier for everyone.
Validate addresses at the door Check syntax, length and domain automatically.
References and further reading
Frequently asked questions
What is the maximum length of an email address?
254 characters in total, with at most 64 octets in the local part and 63 octets in each domain label.
Why 254 and not 256?
The SMTP path limit is 256 octets including the angle brackets around the address, which leaves 254 for the address itself.
How long should my database column be?
VARCHAR(254), or 255 if you prefer a margin, in a Unicode-capable character set.
Should I truncate long addresses?
No. Reject them, because a truncated address may be a different valid address.
Are long email addresses common?
No. Most addresses are short. Very long ones are usually system-generated, plus-tagged or test data.