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 ("").
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 ("").
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 ...
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
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"
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.
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.
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, ...
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.
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.
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> <
YouTube
youtube.com › watch
How to Create a Simple Login Form in HTML and CSS | Login Page Design - YouTube
How to Create a Simple Login Form in HTML and CSS | Login Page DesignLearn how to create a simple login form using HTML and CSS with this step-by-step tutori...
Published September 4, 2024
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
June 11, 2025 - 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 ...
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
GitHub
github.com › GittiHab › HTML-Secure › blob › master › login.html
HTML-Secure/login.html at master · GittiHab/HTML-Secure
July 23, 2023 - <input type="text" name="login_field" />Username · </label> <label> <input type="password" name="password_field" />Password · </label> <button><i class="icon-lock-open-alt"><...
Author GittiHab