Last Updated : 11 Jul, 2025
HTML <input type="password"> is used to specify the password field of the input tag. Password should be served over the HTTPS pages because it includes the sensitive information of the user.
Note: We can add the <label> tag for improved accessibility.
Syntax
<input type="password">
Example: We are using the HTML <input type="password"> to create a password field where characters are masked, enhancing security by hiding sensitive information like passwords from plain view.
HTML
<!DOCTYPE html>
<html>
<body>
<h3>HTML input type="password" Example</h3>
<form action="/action_page.php" method="post">
<label for="email">Email:</label>
<input type="email" name="email"
placeholder="Email Address"
required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$">
<br>
<br>
<label for="paswword">Password:</label>
<input type="password" name="password"
placeholder="Password" required>
<br>
<br>
<input type="submit" value="Login">
</form>
</body>
</html>
Output HTML input type="password" Example Output
Tips for Password Input in HTMLNote: Always ensure that forms containing sensitive information, such as passwords, are served over HTTPS to protect user data.
Here are a few tips for using <input type="password">:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4