What does it mean to normalize an email address?

For email addresses, [email protected] and [email protected] are equivalent; the domain part is case-insensitive according to the RFC specs. Normalizing means providing a canonical representation, so that any two equivalent email strings normalize to the same thing.

The comments on the Django method explain:

Normalize the email address by lowercasing the domain part of it.


One application of normalizing emails is to prevent multiple signups. If your application lets the public to sign up, your application might attract the "unkind" types, and they could attempt to sign up multiple times with the same email address by mixing symbols, upper and lower cases to make variants of the same email address.

From Django's repository, the docstring of normalize_email is the following:

Normalize the email address by lowercasing the domain part of it.

What this method does is to lowercase the domain part of an email, so this part is case insensitive, so consider the following examples:

>>> from django.contrib.auth.models import BaseUserManager
>>> BaseUserManager.normalize_email("[email protected]")
[email protected]
>>> BaseUserManager.normalize_email("[email protected]")
[email protected]
>>> BaseUserManager.normalize_email("[email protected]")
[email protected]
>>> BaseUserManager.normalize_email("[email protected]")
[email protected]
>>> BaseUserManager.normalize_email("[email protected]")
[email protected]

As you can see all emails are equivalent because the case after @ is irrelevant.

Tags:

Email

Django