HTML <input type="password"> (original) (raw)

Last Updated : 23 May, 2026

The HTML element is used to create a password field in a form. The entered characters are hidden or masked for security purposes.

**Syntax:

**Note: We can add the tag for improved accessibility.

**Example: Using the HTML to create a password field where characters are masked, enhancing security by hiding sensitive information like passwords from plain view.

HTML `

HTML input type="password" Example

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

`

**Note: Always ensure that forms containing sensitive information, such as passwords, are served over HTTPS to protect user data.

Best Practices for HTML Password Input

Here are a few tips for using :