<input type="email">

This translation is incomplete. Please help translate this article from English

Los elementos <input> de tipo "email" permiten al usuario introducir y editar una dirección de correo electrónico, o, si el atributo multiple es especificado, una lista de direcciones de correo electrónico.

El valor de entrada se valida automáticamente para asegurar que no esté vacío o que contiene un formato válido de dirección de correo electrónico (o una lista de direcciones) antes de que el formulario sea enviado. Las pseudo clases CSS :valid e :invalid se aplican automáticamente según corresponda.

Los navegadores que no admiten el tipo "email" vulven a ser una entrada de texto estándar.

Value Un DOMString representa una dirección de correo electrónico, o vacío
Eventos changeinput
Atributos comunes compatibles autocomplete, list, maxlength, minlength, multiple, pattern, placeholder, readonly, y size
Atributos IDL list y value
Métodos select()
Value Un DOMString representa una dirección de correo electrónico, o vacío
Eventos change e input
Atributos comunes compatibles autocomplete, list, maxlength, minlength, multiple, pattern, placeholder, readonly, y size
Atributos IDL list y value
Métodos select()


El atributo value del elemento <input> contiene un DOMString que se valida automáticamente conforme a la sintáxis del correo electrónico. Más específicamente, hay tres posibles formatos que pasarán la validación:

  1. Una cadena vacía ("") que indica que el usuario no ingresó un valor o que el valor fue eliminado.
  2. Una única dirección de correo electrónico correctamente formada. Esto no significa necesariamente que exista la dirección de correo electrónico, pero al menos está formateada correctamente. En términos simples, esto significa "username@domain.tld". Hay más que eso, por supuesto; consulte Validation para una regexp que coincida con el algoritmo de validación de direcciones de correo electrónico.
  3. Si y solo si se especifica el atributo multiple, el valor puede ser una lista de direcciones de correo electrónico correctamente formadas separadas por comas. Cualquier espacio en blanco al principio y al final se elimina de cada dirección en la lista.
  4. Si y solo si se especifica el atributo multiple, el valor puede contener una lista de direcciones de correo electrónico correctamente formadas y separadas por coma. Cualquier espacio en blanco al inicio y al final de cada dirección de correo electrónico se elimina.

Consulte Validation para obtener detalles sobre cómo se validan las direcciones de correo electrónico para garantizar que tengan el formato correcto. 

Atributos adicionales

Además de los atributos que operan en todos los elementos <input> independientemente de su tipo, las entradas de URL admiten los siguientes atributos:

Atributo Descripción
maxlength El número máximo de caracteres permitidos

El número mínimo de caracteres para aceptar como una entrada válida


Si se permite o no que se ingresen múltiples direcciones de correo electrónico separadas por comas


Una expresión regular que define lo que constituye un valor de entrada válido


Un valor booleano que, si está presente, indica que el valor no se puede editar


Controla si se habilita o no la revisión ortográfica para el campo de entrada, o si se debe usar la configuración predeterminada de corrección ortográfica


The maximum number of characters (as UTF-16 code units) the user can enter into the URL field. This must be an integer value 0 or higher. If no maxlength is specified, or an invalid value is specified, the URL field has no maximum length. This value must also be less than or equal to the value of minlength.

The input will fail constraint validation if the length of the text entered into the field is greater than minlength UTF-16 code units long.


The minimum number of characters (as UTF-16 code units) the user can enter into the URL field. This must be an integer value greater than or equal to the value specified by maxlength. If no minlength is specified, or an invalid value is specified, the URL input has no minimum length.

The entered URL will fail constraint validation if the length of the text entered into the field is fewer than minlength UTF-16 code units long.


A Boolean attribute which, if present, indicates that the user can enter a list of multiple email addresses, separated by commas and, optionally, whitespace characters. See Allowing multiple email addresses for details.

Note: Normally, if you specify the required attribute, the user must enter a valid email address for the field to be considered valid. However, if you add the multiple attribute, a list of zero email addresses (an empty string, or one which is entirely whitespace) is a valid value. In other words, the user does not have to enter even one email address when multiple is specified, regardless of the value of required.


The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds.

If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see Overriding BiDi using Unicode control characters in The Unicode Bidirectional Text Algorithm for those characters.

Note: Avoid using the placeholder attribute if you can. It is not as semantically useful as other ways to explain your form, and can cause unexpected technical issues with your content. See Labels and placeholders in <input>: The Input (Form Input) element for more information.


The pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation. It must be a valid JavaScript regular expression, as used by the RegExp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of Unicode code points, instead of as ASCII. No forward slashes should be specified around the pattern text.

If the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely.

Tip: Use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. You should also include other explanatory text nearby.

See the section Pattern validation for details and an example.


A Boolean attribute which, if present, means this field cannot be edited by the user. Its value can, however, still be changed from JavaScript code that directly sets the value of the HTMLInputElement.value property.

Note: Because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.


The size attribute is a numeric value indicating how many characters wide the input field should be. The value must be a number greater than zero, and the default value is 20. Since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use).

This does not set a limit on how many characters the user can enter into the field. It only specifies approximately how many can be seen at a time. To set an upper limit on the length of the input data, use the maxlength attribute.


Non-standard attributes

The following non-standard attributes are available to e-mail address input fields. As a general rule, you should avoid using them unless it can't be helped.

Attribute Description
autocorrect A string indicating whether or not autocorrect is "on" or "off". Safari only.
mozactionhint A string providing a hint as to what will happen when the input is submitted; this string is used to decide on an appropriate label for the Enter key on the virtual keyboard. Firefox for Android only.


A Safari extension, the autocorrect attribute is a string which indicates whether or not to activate automatic correction while the user is editing this field. Permitted values are:

Enable automatic correction of typos, as well as processing of text substitutions if any are configured.
Disable automatic correction and text substitutions.


A Mozilla extension, supported by Firefox for Android, which provides a hint as to what sort of action will be taken if the user presses the Enter or Return key while editing the field. This information is used to decide what kind of label to use on the Enter key on the virtual keyboard.

Note: This has been standardized as the global attribute enterkeyhint, but is not yet widely implemented. To see the status of the change being implemented in Firefox, see bug 1490661.

Permitted values are: go, done, next, search, and send. The browser decides, using this hint, what label to put on the enter key.

Using email inputs

Email addresses are among the most frequently-inputted textual data forms on the web; they're used when logging into web sites, when requesting information, to allow order confirmation, for webmail, and so forth. As such, the "email" input type can make your job as a web developer much easier since it can help simplify your work when building the user interface and logic for email addresses. When you create an email input with the proper type value, "email", you get automatic validation that the entered text is at least in the correct form to potentially be a legitimate email address. This can help avoid cases in which the user mistypes their address, or provides an invalid address.

It's important, however, to note that this is not enough to ensure that the specified text is an email address which actually exists, corresponds to the user of the site, or is acceptable in any other way. It simply ensures that the value of the field is properly formatted to be an email address.

Note: It's also crucial to remember that a user can tinker with your HTML behind the scenes, so your site must not use this validation for any security purposes. You must verify the email address on the server side of any transaction in which the provided text may have any security implications of any kind.

A simple email input

Currently, all browsers which implement this element implement it as a standard text input field with basic validation features. The specification does, however, allow browsers latitude on this. For example, the element could be integrated with the user's device's built-in address book to allow picking email addresses from that list. In its most basic form, an email input can be implemented like this:

<input id="emailAddress" type="email">

Notice that it's considered valid when empty and when a single validly-formatted email address is entered, but is otherwise not considered valid. By adding the required attribute, only validly-formed email addresses are allowed; the input is no longer considered valid when empty.

Allowing multiple email addresses

By adding the multiple Boolean attribute, the input can be configured to accept multiple email addresses.

<input id="emailAddress" type="email" multiple>

The input is now considered valid when a single email address is entered, or when any number of email addresses separated by commas and, optionally, some number of whitespace characters are present.

Note: When "multiple" is used, the value is allowed to be empty.

Some examples of valid strings when "multiple" is specified:

  • ""
  • "me@example"
  • "me@example.org"
  • "me@example.org,you@example.org"
  • "me@example.org, you@example.org"
  • "me@example.org,you@example.org,    us@example.org"

Some examples of invalid strings:

  • ","
  • "me"
  • "me@example.org you@example.org"


Sometimes it's helpful to offer an in-context hint as to what form the input data should take. This can be especially important if the page design doesn't offer descriptive labels for each <input>. This is where placeholders come in. A placeholder is a value that demonstrates the form the value should take by presenting an example of a valid value, which is displayed inside the edit box when the element's value is "". Once data is entered into the box, the placeholder disappears; if the box is emptied, the placeholder reappears.

Here, we have an "email" input with the placeholder "sophie@example.com". Note how the placeholder disappears and reappears as you manipulate the contents of the edit field.

<input type="email" placeholder="sophie@example.com">

Controlling the input size

You can control not only the physical length of the input box, but also the minimum and maximum lengths allowed for the input text itself.

Physical input element size

The physical size of the input box can be controlled using the size attribute. With it, you can specify the number of characters the input box can display at a time. In this example the email edit box is 15 characters wide:

<input type="email" size="15">

Element value length

The size is separate from the length limitation on the entered email address itself so that you can have fields fit in a small space while still allowing longer email address strings to be entered. You can specify a minimum length, in characters, for the entered email address using the minlength attribute; similarly, use maxlength to set the maximum length of the entered email address.

The example below creates a 32 character-wide email address entry box, requiring that the contents be no shorter than 3 characters and no longer than 64 characters.

<input type="email" size="32" minlength="3" maxlength="64">

Providing default options

As always, you can provide a default value for an "email" input box by setting its value attribute:

<input type="email" value="default@example.com">

Offering suggested values

Taking it a step farther, you can provide a list of default options from which the user can select by specifying the list attribute. This doesn't limit the user to those options, but does allow them to select commonly-used email addresses more quickly. This also offers hints to autocomplete. The list attribute specifies the ID of a <datalist>, which in turn contains one <option> element per suggested value; each option's value is the corresponding suggested value for the email entry box.

<input type="email" size="40" list="defaultEmails">

<datalist id="defaultEmails">
  <option value="jbond007@mi6.defence.gov.uk">
  <option value="jbourne@unknown.net">
  <option value="nfury@shield.org">
  <option value="tony@starkindustries.com">
  <option value="hulk@grrrrrrrr.arg">

With the <datalist> element and its <option>s in place, the browser will offer the specified values as potential values for the email address; this is typically presented as a popup or drop-down menu containing the suggestions. While the specific user experience may vary from one browser to another, typically clicking in the edit box presents a drop-down of the suggested email addresses. Then, as the user types, the list is filtered to show only matching values. Each typed character narrows down the list until the user makes a selection or types a custom value.

Animation: Using keyboard entry to filter the list of suggested email addresses


There are two levels of content validation available for "email" inputs. First, there's the standard level of validation offered to all <input>s, which automatically ensures that the contents meet the requirements to be a valid email address. But there's also the option to add additional filtering to ensure that your own specialized needs are met, if you have any.

Important: HTML form validation is not a substitute for scripts that ensure that the entered data is in the proper format.  It's far too easy for someone to make adjustments to the HTML that allow them to bypass the validation, or to remove it completely. It's also possible for someone to simply bypass your HTML entirely and submit the data directly to your server. If your server-side code fails to validate the data it receives, disaster could strike when improperly-formatted data (or data which is too large, is of the wrong type, and so forth) is entered into your database.

Basic validation

Browsers that support the "email" input type automatically provide validation to ensure that only text that matches the standard format for Internet email addresses is entered into the input box. Browsers that implement the specification should be using an algorithm equivalent to the following regular expression:


To learn more about how form validation works and how to take advantage of the :valid and :invalid CSS properties to style the input based on whether or not the current value is valid, see Form data validation.

Note: There are known specification issues related to international domain names and the validation of email addresses in HTML. See W3C bug 15489 for details.

Pattern validation

If you need the entered email address to be restricted further than just "any string that looks like an email address," you can use the pattern attribute to specify a regular expression the value must match for it to be valid. If the multiple attribute is specified, each individual item in the comma-delineated list of values must match the regexp.

For example, let's say you're building a page for employees of Best Startup Ever, Inc. which will let them contact their IT department for help. In our simplified form, the user needs to enter their email address and a message describing the problem they need help with. We want to ensure that not only does the user provide a valid email address, but for security purposes, we require that the address be an internal corporate email address.

Since inputs of type "email" validate against both the standard email address validation and the specified pattern, you can implement this easily. Let's see how:

 <div class="emailBox">
   <label for="emailAddress">Your email address</label><br>
   <input id="emailAddress" type="email" size="64" maxLength="64" required
          placeholder="username@beststartupever.com" pattern=".+@beststartupever.com"
          title="Please provide only a Best Startup Ever corporate email address">

 <div class="messageBox">
   <label for="message">Request</label><br>
   <textarea id="message" cols="80" rows="8" required
             placeholder="My shoes are too tight, and I have forgotten how to dance."></textarea>
  <input type="submit" value="Send Request">

Our <form> contains one <input> of type "email" for the user's email address, a <textarea> to enter their message for IT into, and an <input> of type "submit", which creates a button to submit the form. Each text entry box has a <label> associated with it to let the user know what's expected of them.

Let's take a closer look at the email address entry box. Its size and maxlength attributes are both set to 64 in order to show room for 64 characters worth of email address, and to limit the number of characters actually entered to a maximum of 64. The required attribute is specified, making it mandatory that a valid email address be provided.

An appropriate placeholder is provided—"username@beststartupever.com"—to demonstrate what constitutes a valid entry. This string demonstrates both that an email address should be entered, and suggests that it should be a corporate beststartupever.com account. This is in addition to the fact that using type "email" will validate the text to ensure that it's formatted like an email address. If the text in the input box isn't an email address, you'll get an error message that looks something like this:

If we left things at that, we would at least be validating on legitimate email addresses. But we want to go one step farther: we want to make sure that the email address is in fact in the form "username@beststartupever.com". This is where we'll use pattern.  We set pattern to ".+@beststartupever.com". This simple regular expression requests a string that consists of at least one character of any kind, then an "@" followed by the domain name "beststartupever.com".

Note that this is not even close to an adequate filter for valid email addresses; it would allow things such as " @beststartupever.com" (note the leading space) or "@@beststartupever.com", neither of which is valid. However, the browser runs both the standard email address filter and our custom pattern against the specified text. As a result, we wind up with a validation which says "make sure this resembles a valid email address, and if it is, make sure it's also a beststartupever.com address."

It's advisable to use the title attribute along with pattern. If you do, the title must describe the pattern. That is, it should explain what format the data should take on, rather than any other information. That's because the title may be displayed or spoken as part of a validation error message. For example, the browser might present the message "The entered text doesn't match the required pattern." followed by your specified title. If your title is something like "Email address", the result would be the message "The entered text doesn't match the required pattern. Email address", which isn't very good.

That's why, instead, we specify the string "Please provide only a Best Startup Ever corporate email address" By doing that, the resulting full error message might be something like "The entered text doesn't match the required pattern. Please provide only a Best Startup Ever corporate email address."

Note: If you run into trouble while writing your validation regular expressions and they're not working properly, check your browser's console; there may be helpful error messages there to aid you in solving the problem.


Here we have an email input with the ID "emailAddress" which is allowed to be up to a maximum of 256 characters long. The input box itself is physically 64 characters wide, and displays the text "user@example.gov" as a placeholder anytime the field is empty. In addition, by using the multiple attribute, the box is configured to allow the user to enter zero or more email addresses, separated by commas, as described in Allowing multiple email addresses. As a final touch, the list attribute contains the ID of a <datalist> whose <option>s specify a set of suggested values the user can choose from.

As an added touch, the <label> element is used to establish a label for the email entry box, with its for attribute referencing the "emailAddress" ID of the <input> element. By associating the two elements in this way, clicking on the label will focus the input element.

<label for="emailAddress">Email</label><br/>
<input id="emailAddress" type="email" placeholder="user@example.gov"
       list="defaultEmails" size="64" maxlength="256" multiple>

<datalist id="defaultEmails">
  <option value="jbond007@mi6.defence.gov.uk">
  <option value="jbourne@unknown.net">
  <option value="nfury@shield.org">
  <option value="tony@starkindustries.com">
  <option value="hulk@grrrrrrrr.arg">


Specification Status Comment
HTML Living Standard
La definición de '<input type="email">' en esta especificación.
Living Standard Initial definition
HTML 5.1
La definición de '<input type="email">' en esta especificación.
Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome para AndroidFirefox para AndroidOpera para AndroidSafari en iOSSamsung Internet
type="email"Chrome Soporte completo 5Edge Soporte completo 12Firefox Soporte completo SiIE Soporte completo 10Opera Soporte completo 11Safari Soporte completo SiWebView Android ? Chrome Android ? Firefox Android Soporte completo 4Opera Android Soporte completo SiSafari iOS Soporte completo 3.1
Soporte completo 3.1
Notas Doesn't do validation, but instead offers a custom 'email' keyboard, which is designed to make entering email addresses easier.
Notas The custom 'email' keyboard does not provide a comma key, so users cannot enter multiple email addresses.
Notas Automatically applies a default style of opacity: 0.4 to disable textual <input> elements, including those of type 'email'. Other major browsers don't currently share this particular default style.
Samsung Internet Android ?


Soporte completo  
Soporte completo
Compatibilidad desconocida  
Compatibilidad desconocida
Ver notas de implementación.
Ver notas de implementación.

See also