Open In App

HTML <input type=”password”>

Last Updated : 06 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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.

Syntax: 

<input type="password">

Example: 

Here is the basic implementation of HTML <input type=”password”>. Here password input field where characters are masked, enhances security by hiding sensitive information like passwords from plain view.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>HTML input type="password"</title>
</head>
  
<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: In the above example we create an input field for email and password. The email field includes the format validation and the submit button allows form submission.

HTML-input-type_password

HTML input type=”password” Example Output

HTML input type=”paswword” Related Questions

1. How do we take password input in HTML forms ?

This can be done by using the <input> tag with type attribute which is set to the value “password“.

2. How to Hide Password in HTML ?

Hiding the password is commonly known as Password Masking. It is always a good practice to use password masking to ensure security and avoid misuse.

Supported Browsers:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads