What Is the Maximum Length of an Email Address?

Previously, we have discussed the maximum length of a domain name. We have seen that even though the domain can be as long as 255 octets (8 bits), the actual length in characters was 253 characters. A natural next question might be: what about an email address? Well, it turns out the answer is also not entirely straightforward, albeit for different reasons.

Anatomy of an Email Address

Let us consider an email like samvimes@citywatch.com. We can see that it is made up of three parts.

  • samvimes. This is called a local-part [1]
  • A symbol @, separating the local-part from a domain
  • citywatch.com, a domain. Note that it can also be an IP address, surrounded by [] [2].

Length Restrictions

Considering the email address is made up of three parts, it is logical to assume that each one of them will have a length limit. Indeed, if we take a look at RFC 5321 [3], we see this is the case.

  • For local part, the limit is 64 octets (section 4.5.3.1.1 [4])
  • For @, the min/max length is obviously 1
  • For domain, the length is 255 octets (section 4.5.3.1.2 [5])

This would seem to imply that the maximum length of an email address should be 320 characters (64 + 1 + 255 = 320). In fact, RFC 3696, section 3 [6] states (emphasis mine):

In addition to restrictions on syntax, there is a length limit on email addresses. That limit is a maximum of 64 characters (octets) in the "local part" (before the "@") and a maximum of 255 characters (octets) in the domain part (after the "@") for a total length of 320 characters. Systems that handle email should be prepared to process addresses which are that long, even though they are rarely encountered.

The Reality

Actual maximum email address length is not 320, though. To understand why, some background on how emails are sent is necessary. For this particular question, it is enough to know that Simple Mail Transfer Protocol (SMTP) [7] is employed. Sending mail in SMTP involves three steps [8]:

  1. Transaction starts with MAIL command that gives the sender identification. It is defined as follows:

    MAIL FROM:<reverse-path> [SP <mail-parameters> ] <CRLF>
  2. Then a series of one or more RCPT commands follow. They provide recipient’s information, and are defined thusly:

    RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>
  3. Finally, DATA command initiates transfer of mail data. While irrelevant for this particular issue, for completeness sake this is its definition:

    DATA <CRLF>

Now, I don’t know about you, but reverse-path and forward-path don’t tell me much. Digging into RFC 5321, section 4.1.2 [9], we can find more details:

Reverse-path = Path / "<>"
Forward-path = Path

We see that reverse-path and forward-path are made up of Path. Path itself is made up of a Mailbox surrounded by angle brackets:

Path = "<" [ A-d-l ":" ] Mailbox ">"

And what is the maximum length of a Path? RFC 5231, section 4.5.3.1.3 [10] has an answer (emphasis mine):

The maximum total length of a reverse-path or forward-path is 256 octets (including the punctuation and element separators).

Given that Mailbox is none other than email address (from RFC 5321, section 4.1.2 linked above):

Mailbox = Local-part "@" ( Domain / address-literal )

We can use all of this knowledge to derive an answer.

The Answer

We’ve seen that SMTP command uses Path to define email address from which we send an email, and email address(-es) to which we send it. Path has maximum length of 256 octets. Since it must include angle brackets, we’re left with 254 octets for the actual email address. As one octet is 8 bits, this means we have 254 characters or less (if using non-ASCII encoding) for the email address.

Sources

  1. https://en.wikipedia.org/wiki/Email_address#Local-part
  2. https://en.wikipedia.org/wiki/Email_address#Domain
  3. https://datatracker.ietf.org/doc/html/rfc5321
  4. https://datatracker.ietf.org/doc/html/rfc5321#section-4.5.3.1.1
  5. https://datatracker.ietf.org/doc/html/rfc5321#section-4.5.3.1.2
  6. https://datatracker.ietf.org/doc/html/rfc3696#section-3
  7. https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
  8. https://datatracker.ietf.org/doc/html/rfc5321#section-3.3
  9. https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.2
  10. https://datatracker.ietf.org/doc/html/rfc5321#section-4.5.3.1.3

Further Reading