HTML alone can't do this you need some other language in backend to check password. Or you can use javascript which will verify password in frontend but you have to specify password in the code itself only if you are doing it for fun. Otherwise for developing web app with login page you need a backend language such as php or python and database such as mysql or mariadb to store passwords.
Sample code
You need to create two files one for your login form (login.html) and another to redirect after right password is entered (welcome.html).
This code is for login.html
<!DOCTYPE html>
<html>
<head>
<title>Login page</title>
</head>
<body>
<form>
<label for="pswd">Enter your password: </label>
<input type="password" id="pswd">
<input type="button" value="Submit" onclick="checkPswd();" />
</form>
<!--Function to check password the already set password is admin-->
<script type="text/javascript">
function checkPswd() {
var confirmPassword = "admin";
var password = document.getElementById("pswd").value;
if (password == confirmPassword) {
window.location="welcome.html";
}
else{
alert("Passwords do not match.");
}
}
</script>
</body>
</html>
This code is for welcome.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome page</title>
</head>
<body>
<h1>Welcome!! you entered a right password</h1>
</body>
</html>
Answer from Pratik on Stack OverflowMDN Web Docs
developer.mozilla.org โบ en-US โบ docs โบ Web โบ HTML โบ Reference โบ Elements โบ input โบ password
<input type="password"> - HTML - MDN Web Docs
Many browsers now implement mechanisms to warn against insecure login forms. The value attribute contains a string whose value is the current contents of the text editing control being used to enter the password. If the user hasn't entered anything yet, this value is an empty string ("").
W3Schools
w3schools.com โบ howto โบ howto_css_login_form.asp
How To Create a Login Form
Login Form Signup Form Checkout Form Contact Form Social Login Form Register Form Form with Icons Newsletter Stacked Form Responsive Form Popup Form Inline Form Clear Input Field Hide Number Arrows Copy Text to Clipboard Animated Search Search Button Fullscreen Search Input Field in Navbar Login Form in Navbar Custom Checkbox/Radio Custom Select Toggle Switch Check Checkbox Detect Caps Lock Trigger Button on Enter Password Validation Toggle Password Visibility Multiple Step Form Autocomplete Turn off autocomplete Turn off spellcheck File Upload Button Empty Input Validation
Videos
05:55
Create Modern Login Form using HTML & CSS | How to Create a Simple ...
Login & Signup with HTML, CSS, JavaScript (form validation) - YouTube
How to make Login, Registration and Forgot Password Form ...
11:07
Login Form in HTML & CSS - YouTube
14:06
How To Make Login Form With Password Toggle In HTML CSS JS - YouTube
13:28
How to Create HTML Form (Username and Password) for Beginners 2018 ...
MDN Web Docs
developer.mozilla.org โบ en-US โบ docs โบ Web โบ HTML โบ Element โบ input โบ password
<input type="password"> - HTML: HyperText Markup Language
Many browsers now implement mechanisms to warn against insecure login forms. The value attribute contains a string whose value is the current contents of the text editing control being used to enter the password. If the user hasn't entered anything yet, this value is an empty string ("").
Stack Overflow
stackoverflow.com โบ questions โบ 74496402 โบ basic-html-login-form
Basic HTML login form - Stack Overflow
Basically it was a simple login form that sends the user to a specified URL if the text is correct. Something like if input type text is "custom text" and input type password is "custom text" then input type submit button go to ahref "custom url"
Talkerscode
talkerscode.com โบ howto โบ html-code-for-login-page-with-username-and-password.php
HTML Code For Login Page With Username And Password
Now, today here our topic is how to make a login page in html in which there is a username and password option. The main requirement in login form is to have an input for id means the username and with a password. After this there is a button of submit this information. There is also two more options in many website like remember me and forgot password. Now, there is a code that is given here below to make a login page with the help of CSS.
GeeksforGeeks
geeksforgeeks.org โบ html โบ html-login-form
HTML Login Form - GeeksforGeeks
July 23, 2025 - Give the button a clear label describing its action, like "Login" or "Submit". ... Include a "Remember Me" checkbox using the <input> tag with the type attribute set to "checkbox". Add a link to a "Forgot Password" page using the <a> tag. Style the form using CSS for a more appealing look. Close the <form> tag. Add the closing </body> and </html> tags to complete the document.
Medium
medium.com โบ @namaajiabubakarsadiq โบ building-my-login-form-with-html-css-a-step-forward-in-my-web-journey-5196a50849f7
๐ Building My Login Form with HTML & CSS: A Step Forward in My Web Journey | by Abubakar Sadiq Namaaji | Medium
October 19, 2025 - So I decided to design and code a Login Form using only HTML and CSS. It wasnโt my first project, but it was one of the most satisfying ones โ because it made me realize how far Iโve come from writing my first <div> to creating something that actually looks like part of a real website. As always, I started with the foundation. HTML gave my form its structure โ a container, input fields for username and password, a submit button, and a simple heading.
W3Schools
w3schools.com โบ tags โบ att_input_type_password.asp
HTML input type="password"
<!--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hgroup> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <menu> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <
CodeHim
codehim.com โบ home โบ collections โบ 65+ login page in html with css code sample simple to difficult
65+ Login Page in HTML with CSS Code Sample Simple to Difficult โ CodeHim
January 22, 2024 - You can view demo and download HTML and CSS source code for login page that you find fit for your needs. The following is a simple login form that comes with a clean user interface to log in. This login form template has a title, input field for email & password, a link to forget password page, ...
C# Corner
c-sharpcorner.com โบ article โบ creating-a-simple-login-page-using-html-and-css
How to Create a Simple Login Page in HTML with CSS Code
July 9, 2024 - <!DOCTYPE html> <html> <head> <title>Login Form</title> <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <body> <h2>Login Page</h2><br> <div class="login"> <form id="login" method="get" action="login.php"> <label><b>User Name </b> </label> <input type="text" name="Uname" id="Uname" placeholder="Username"> <br><br> <label><b>Password </b> </label> <input type="Password" name="Pass" id="Pass" placeholder="Password"> <br><br> <input type="button" name="log" id="log" value="Log In Here"> <br><br> <input type="checkbox" id="check"> <span>Remember me</span> <br><br> Forgot <a href="#">Password</a> </form> </div> </body> </html> ... Next, write code in CSS to apply some style to the HTML so you can change the look of the login page.
Javatpoint
javatpoint.com โบ html-login-form
HTML Login Form - Javatpoint
HTML Login Form - HTML Login Form with html tutorial, tags, anchor, img, div, entity, textarea, marquee, p tag, heading tag, h1, h2, table, formatting, attribute, elements, ol, ul, Input Types, block element tag, inline element tag, html tags, phrase tag, head, body, form, lists, symbols etc.
DotFactory
dofactory.com โบ html โบ input โบ password
HTML input type="password",
<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"> </form> Try it live
CodeWithFaraz
codewithfaraz.com โบ home โบ blogs โบ 30 login form collection with source code in html, css, and javascript
30 Login Form Collection with Source Code in HTML, CSS, and JavaScript
May 8, 2014 - Step-by-step guide for stylish and interactive login buttons. ... Learn how to create a Neon Brick Breaker game using HTML, CSS, and JavaScript. Simple steps for beginners to build a glowing arcade-style game. ... Learn how to make a random password generator using HTML, CSS, and JavaScript. This beginner tutorial includes step-by-step code and tips for strong passwords.
DhiWise
dhiwise.com โบ post โบ how-to-make-a-login-page-in-html-a-step-by-step-guide
How to Make a Login Page in HTML: A Simple Guide
October 11, 2024 - Using strong password hashing algorithms, enforcing password policies, and providing options for two-factor authentication further enhance the security of your login page. Before diving into the creation process, ensure you have a basic understanding of HTML, CSS, and JavaScript. You'll also need a text editor or Integrated Development Environment (IDE) to write your code ...
W3Schools
w3schools.com โบ howto โบ howto_js_password_validation.asp
How To Create a Password Validation Form
Login Form Signup Form Checkout Form Contact Form Social Login Form Register Form Form with Icons Newsletter Stacked Form Responsive Form Popup Form Inline Form Clear Input Field Hide Number Arrows Copy Text to Clipboard Animated Search Search Button Fullscreen Search Input Field in Navbar Login Form in Navbar Custom Checkbox/Radio Custom Select Toggle Switch Check Checkbox Detect Caps Lock Trigger Button on Enter Password Validation Toggle Password Visibility Multiple Step Form Autocomplete Turn off autocomplete Turn off spellcheck File Upload Button Empty Input Validation