What’s the average length of an email address?

This question always comes up, when you have to design new table in database to store email addresses. Is VARCHAR(30) long enough? Or maybe you should use VARCHAR(255) or maybe TEXT as I’ve seen in some projects?

My live database, which I’ve used for this test contains 92298 valid email addresses, verified with the Pear Validate class with domain checking.

1
2
3
4
5
6
7
8
9
10
if(Validate::email($email,true))
{
    // add to database
    return true;
}
else
{
    // return error
    return false;
}

It means, if the email address is in this database – it is real and correct, otherwise the field is empty. So to make sure not to include empty fields, I’ve issued following query:

SELECT COUNT(*), LENGTH(email) AS SIZE FROM customer WHERE email LIKE '%@%' GROUP BY SIZE ORDER BY SIZE;

This query returns set of values, which I’ve used to create this chart (with OpenOffice.org Calc).

email-length-stats_html_54813cd4

As you can see majority of email addresses are around 13 to 34 characters long. To store email addresses I’ve used VARCHAR (255) but as you can see VARCHAR(50) is enough.

The answer: VARCHAR(50) should do.

5 Responses to “What’s the average length of an email address?”

  1. James Lucas says:

    I would suggest allocating 254 characters for email addresses. I have seen autogenerated email addresses that are 63 characters in length, and seen a 49 character ‘human generated’ email address too – so I don’t think 50 is enough.

    And doesn’t your chart show a 53 character email address at the very end? ;)

    I’ve linked to your blog from the website linked above, an FAQ about email address lengths.

  2. Janusz Słota says:

    You are right, there are longer email addresses, but it doesn’t mean that you have to accept them in your application. Especially when you have to save the space.

    Yes – my chart shows a 53 character long email address, but there is only 1 in collection of 92298. I’d not accept this email in my new applications.

  3. Maximum Length of an Email Address is… | Sean Walther's Blog says:

    [...] a blog that posted a graph of all email addresses in their system: What’s the average length of an email address?[...]

  4. Nick Nolan says:

    Maximum size of email address is 256 characters. If your application does not accept email addresses of that size, it’s defective. Of course you don’t have to, but it’s just very unwise thing to do if your application has any importance.

    Another bug that many applications have is that they don’t accept + sign. It’s becoming more common that you see emails like John.Smith+WorkFolder@example.com where people use the text after + sing to name the folder where email is directed into.

    There are standards and following them makes your apps general and successful.

  5. Janusz Słota says:

    @Nick Nolan

    You are right about maximum length. But blog post answers the question about “the average length” of an email address.

    I’m not saying that anyone should use varchar(50), I’m saying that I use varchar(50) for email addresses, and so far I have no problems with this.

    Thank you for you comment, the post together with the comments will definitely help someone make the right decision.

Leave a Reply