splitforms.com

HTML · FORM CONTROL

HTML input type=email: validation, multiple and autocomplete

<input type="email"> is a text field the browser checks before submit: the value must have one @, a local part and a domain made of valid labels. It does not run a full RFC 5322 check or look up the domain. On phones it brings up an email keyboard, and multiple accepts a comma-separated list.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

email-example.html
<label for="email">Email</label>
<input type="email" id="email" name="email"
       autocomplete="email" required>

Want this form to email you its submissions? Point it at a free splitforms endpoint, with no server to build. Get a free access key →

Copy-paste code

HTML Email Input code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

input-type-email.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="name">Name</label>
  <input type="text" id="name" name="name" autocomplete="name" required>

  <!-- One address, checked by the browser, filled by autofill -->
  <label for="email">Email</label>
  <input type="email" id="email" name="email" autocomplete="email" required>

  <!-- multiple: a comma-separated list, each address checked -->
  <label for="cc">Copy the reply to (optional, separate with commas)</label>
  <input type="email" id="cc" name="cc" multiple>

  <label for="message">Message</label>
  <textarea id="message" name="message" rows="4" required></textarea>

  <!-- Honeypot: hidden from people, bots fill it in -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">

  <button type="submit">Send</button>
</form>

Key facts

What does type=email check?

The browser checks the value against the HTML Standard's valid email address rule, which the spec calls a willful violation of RFC 5322: simpler than the RFC, and strict about the domain. An empty field passes unless it is required.

What does type=email check?
FactDetail
The ruleExactly one @. Before it: letters, digits, dots and symbols such as +, _, - and '. After it: one or more labels split by dots, each 1–63 letters, digits or hyphens, not starting or ending with a hyphen.
Not checkedWhether the domain exists, has mail servers or a real top-level domain. name@example passes, and so does a typo such as name@gmial.com.
Not supportedQuoted local parts ("john doe"@example.com), IP-address domains (name@[192.0.2.1]) and non-ASCII letters before the @, even though RFC 5322 or later RFCs allow some of them.
SpacesLeading and trailing spaces and line breaks are stripped from the value. A space inside the address fails.
JavaScriptel.validity.typeMismatch is true while a non-empty value is not a valid address. el.checkValidity() runs the check.
Mobile keyboardMost mobile browsers show an email keyboard with @ and . close at hand. inputmode="email" asks for the same keyboard on a plain text field.
Autofillautocomplete="email" tells the browser the field wants the person's email address, so it can offer the saved one.
SecurityNone. Anyone can POST to the form's action URL without running the check, so validate the address on the server too.

Sources: WHATWG HTML Standard: email state · WHATWG: valid email address · WHATWG: suffering from a type mismatch · WHATWG: autofill email · MDN: <input type="email"> · MDN: ValidityState.typeMismatch · RFC 5322: Internet Message Format

Validation table

Which email addresses does type=email accept?

Each row is what current browsers do with the HTML Standard's rule. Some addresses the browser accepts would bounce, and some the RFC allows are rejected, which is why the browser check is a typo filter and not proof the address works.

Which email addresses does type=email accept?
AddressBrowser resultWhy
name@example.comValidOne @, a local part and a dotted domain.
name+tag@example.co.ukValid+ is allowed before the @; any number of domain labels.
user@localhostValidNo dot is needed after the @.
first..last@example.comValidAny mix of dots is allowed before the @, though RFC 5322 rejects two dots in a row there.
name@gmial.comValidThe domain is never looked up, so typos pass.
name.example.comInvalidNo @.
name@@example.comInvalidTwo @ signs.
name@-example.comInvalidA domain label can't start or end with a hyphen.
name@example..comInvalidTwo dots in a row leave an empty domain label.
name @example.comInvalidA space inside the address.
"john doe"@example.comInvalidQuoted local parts are not supported, although RFC 5322 allows them.
name@[192.0.2.1]InvalidIP-address domains are not supported.

The live demo above runs your own browser's check: type any of these into the email field and submit.

Sources: WHATWG: valid email address · MDN: <input type="email"> validation

multiple

How does multiple work on an email input?

With multiple, the field takes a comma-separated list. The browser strips spaces around each address, checks every one, and submits the whole list as one field, such as cc=ana@example.com,li@example.com. An empty list is valid unless the field is required.

How does multiple work on an email input?
BehaviourDetail
SeparatorCommas only. Spaces around each address are removed, so a@example.com, b@example.com becomes a@example.com,b@example.com.
ValidationEvery address must be valid. One bad address makes the whole field fail with typeMismatch.
What gets submittedOne name/value pair holding the joined list, not one entry per address. Split it on , on the server.
patternChecked against each address on its own.
minlength / maxlengthCount the whole list, not each address.

Sources: WHATWG: valid email address list · WHATWG: the multiple attribute · MDN: multiple

Attributes · <input type=email>

Which HTML Email Input attributes matter?

These attributes decide how the <input type=email> behaves and what actually gets emailed to your inbox when someone submits.

HTML Email Input attributes and what each one does
AttributeWhat it doesDocs
type="email"Makes the field check for a valid address and show an email keyboard on phones.MDN
autocomplete="email"Lets the browser fill in the saved email address. Use it on every field that asks for the person's own email.MDN
multipleAccepts a comma-separated list of addresses and checks each one.MDN
requiredBlocks the submit while the field is empty. Without it, an empty email field is valid.MDN
patternAdds your own rule on top, for example only company addresses. Checked per address with multiple.MDN
minlength / maxlengthLimit the length of the whole value.MDN
listPoints at a <datalist> of suggested addresses.MDN
validity.typeMismatchJavaScript: true while a non-empty value is not a valid address.MDN

Common mistakes

HTML Email Input not working? Here's why.

Most broken forms come down to a few small mistakes with the <input type=email>. Check these before you ship, then forward every submission to Slack or a webhook.

  1. A valid address is not a working address

    The browser only checks the shape. name@gmial.com passes. Check the domain on the server, or send a confirmation email when the address really matters.

  2. Don't set type=email and a strict regex that fights it

    A pattern runs as well as the built-in rule, never instead of it. A pattern that allows quoted local parts can't make them pass, and an overly strict one turns away real addresses such as ones with +tags.

  3. The browser check can be skipped

    novalidate, form.submit() and direct POST requests skip it. Re-check the address on the server before you reply to it or add it to a list.

  4. multiple sends one string

    With multiple the server gets one comma-separated value, not an array. Split it on commas before you use the addresses.

Sources: WHATWG HTML Standard: email state · WHATWG: valid email address · MDN: <input type="email">

Server side

Why browser validation isn't enough

type="email" catches typos such as a missing @, but it never checks that the domain exists or can receive mail, and anyone can skip it with a direct POST. Re-check the address on the server with the same rule the browser uses, then check the domain. Test addresses against common patterns with the email regex tester, and check a domain's MX, SPF and DMARC records with the email deliverability checker.

The regex below is the one the HTML Standard gives for a valid email address, so the server accepts exactly what the browser accepts.

check-email.js
// The HTML Standard's "valid email address" rule
const EMAIL = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;

export function isEmail(value) {
  return EMAIL.test(String(value).trim());
}

// For multiple: split the one comma-separated value first
export function emailList(value) {
  return String(value).split(",").map((s) => s.trim()).filter(Boolean);
}

Regex patterns for form fields

Use your validation patterns as you assemble a form with our HTML contact form code or HTML form generator.

Key benefits

Copy-paste ready

The HTML Email Input example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html email input form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this <input type=email> form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML Email Input to any page.

Copy the html email input example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

  1. Copy the code

    Copy the HTML Email Input example below.

  2. Add your access key

    Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

  3. Paste into your site

    Drop the form into any HTML page. Submissions arrive in your dashboard.

Questions

HTML Email Input questions, answered.

Anything missing? Email us, we read every message.

A person reading answers to common questions
What does input type=email validate?

It checks that the value has exactly one @, a local part made of letters, digits, dots and a few symbols, and a domain of dot-separated labels made of letters, digits and hyphens. It does not run a full RFC 5322 check, so quoted names and IP-address domains fail, and odd but allowed-by-browser forms like user@localhost pass.

Does type=email check the domain exists?

No. The browser never looks up the domain, so name@gmial.com passes as long as it has the right shape. To catch fake or mistyped domains, check the domain's MX records on the server, or send a confirmation email. The splitforms email deliverability checker shows a domain's MX, SPF and DMARC records.

How do I allow several emails?

Add the multiple attribute: <input type="email" name="cc" multiple>. People separate addresses with commas, the browser strips spaces around each one and checks every address, and the form submits them as one comma-separated value that you split on the server.

What autocomplete value should an email field use?

autocomplete="email". It tells the browser the field wants the person's own email address, so autofill can offer the saved one.

Does type=email show a special keyboard on mobile?

Yes, on most mobile browsers: an email keyboard with the @ and . keys easy to reach. inputmode="email" asks for the same keyboard on a field that is not type=email.

Is an empty email field valid?

Yes. The email check only runs on a non-empty value, so add required if the address is mandatory.

Show 1 more questions
Can I change the email error message?

Yes. Call setCustomValidity("Your message") in the field's invalid event when validity.typeMismatch is true, and clear it with setCustomValidity("") in its input event, or the field stays invalid.

View all FAQs

Make this form actually submit.

Point your form at splitforms. 500 free submissions a month, spam filtering, webhooks on paid plans — no server.

  • No credit card required
  • 500 free submissions
  • Setup in minutes
Two people celebrating a working contact form