HTML <input> type="password"

The <input> tag with a type="password" attribute creates a text field where users can securily enter a password. As characters are entered, they are replaced by a dot ("•") or asterisk ("*") symbol, depending on the browser.

Example

#

An <input> element of type password.
Characters entered in the password field are replaced by another symbol.





<form action="/tutorial/action.html">
  <label for="fullname">Username</label><br />
  <input type="text" id="username" name="username"><br />
  <label for="password">Password</label><br />
  <input type="password" id="password" name="password"><br />

  <input type="submit" value="Login">
</form>

Note: For security reasons do not submit password fields with the GET method (like the example above). Always use POST.


Using input type="password"

The <input type="password"> creates an input field for passwords.

Values entered are treated securely; they are masked and restricted in their use, for example, cannot copy.

The password masking character depends on the browser. It can be asterisk, dot, circle, and others.


Syntax

<input type="password">

Browser support

Here is when type="password" support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <input>
Guides