Email address

Example

When to use

When collecting an email address.

When to consider something else

For physical addresses, see the postal address page.

Guidance

Email addresses may be considered sensitive information. When asking for an email address, tell the user why you require this information. This may be implicit (such as registering for a service) but may not be obvious to the user in all situations.

Telling the user why you require their email address may also help them choose which one is most appropriate for your service, for example, if they have different work and personal addresses.

Use type="email" to activate browser validation and enable context appropriate keyboards on supporting devices.

Allow the user to paste their email address from elsewhere. This helps ensure the address is correct and allows the use of password management software, increasing user security.

Validating input

Error state

To check that an email address is valid, make sure that:

The requirements for the format of email addresses is defined in RFC 822. Allowed formats for the local part of an addresses include:

Allowed formats for the domain part of an address include:

There is no guarantee that there will be a period or domain extension in the domain part of the address.

The specification for email addresses is incredibly wide reaching, and it’s difficult to make a regular expression that can accurately reflect all possibilities. It is simpler to ensure that the required parts exist, then use another method—such as sending an email to that address—to ensure the address itself is real.

Do not test for a minimum or maximum length. There are some very long email addresses out there.

Autofill

Using autocomplete="email" tells the browser to autofill the field with the user’s email address. If collecting an email address that doesn’t belong to the current user, omit this attribute.

Mobile devices

Devices with soft keyboards will normally show a context appropriate keyboard for email addresses. This is specifically triggered by the type="email" attribute.

The nonstandard autocorrect attribute setting disables spelling and grammar correction on Safari, which is usually undesirable on email addresses.