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.



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">

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.


<input type="password">

Browser support

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

1.0 Sep 2008
1.0 Sep 2002
1.0 Aug 1995
1.0 Jan 2006
1.0 Jan 2003

You may also like

 Back to <input>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023

What's your favorite/least favorite part of Dofactory?