HTML: input type="password"
A password input masks characters on screen, but it does not encrypt the value or make an insecure login safe by itself.
What you will learn
- How to label and require a password field
- How autocomplete helps password managers
- Which security responsibilities remain on the server
Minimal example
<label for="password">Password</label>
<input id="password" name="password" type="password"
autocomplete="current-password" required>Connect a visible <label> to the input. Use current-password for an existing login and new-password when creating or changing a password.
Security and usability notes
- Submit passwords only over HTTPS and validate them on the server.
- Masking hides characters from nearby viewers; it does not protect the value from scripts, network errors, or a compromised server.
- Do not disable password managers with unnecessary
autocomplete="off". - Allow users to reveal the password when appropriate, and make the control keyboard accessible.