Email input on mobile

One attribute fixes most email field problems on a phone.

<label for="em">Email</label>
<input id="em" name="email" type="email" autocomplete="email">

What type="email" gives you

When you cannot use type="email"

Some sign-in forms take "email or username" in one field. Then use type="text" with inputmode="email", autocapitalize="none", autocorrect="off", spellcheck="false" and autocomplete="username". That keeps the @ keyboard, stops the capital letter and lets password managers fill it.

Validation that does not reject real addresses

Check for one @ with something on both sides and a dot in the domain; that is all you can verify without sending a message. Strip spaces at the start and end, because autofill and paste sometimes add one. Do not reject plus addresses such as [email protected].

Confirm-email fields

Asking people to type their email twice mostly leads to copy and paste of the same typo. Show the address back to them clearly instead, or send a confirmation link.

Frequently asked questions

Does type="email" stop capital letters on iPhone?

Yes. The iPhone does not auto-capitalize email fields. For a text field, add autocapitalize="none".

Which autocomplete value for email?

email. On a sign-in form where the email is the account name, username is also accepted by password managers.

Found a mistake or want a check added? Write to contact (at) mobileformcheck.com.