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.

3 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?[...]

Leave a Reply