Building a Password Generator with HTML, CSS, and JavaScript

Ashwin Upadhyay
2 min readMar 2, 2024

--

Passwords are an important part of online security, but coming up with strong and unique passwords can be difficult. That’s why I decided to build a simple password generator using HTML, CSS, and JavaScript.

I started by setting up the basic HTML structure with input fields, buttons, and placeholders for where the generated password would go. I used CSS to style the page and make it look nice.

The most complex part was writing the JavaScript to actually generate random passwords. I used the math.random() function along with some string methods like split and join to create passwords with random characters.

Some key features of my password generator:

  • Lets user select password length between 8 and 128 characters
  • Options to include uppercase letters, lowercase letters, numbers, and symbols
  • Generates a new random password each time the button is clicked
  • Displays the password inside the text box for easy copying

Overall, this project was great JavaScript practice. Generating the random passwords required me to think through the logic and syntax. I also learned more about working with user input via the text boxes and buttons.

The finished password generator is simple but functional. Users can easily create as many secure passwords as they need. I’m proud of how it turned out, especially given that it was built primarily using plain JS, HTML and CSS.

You can check out the source code on GitHub here: https://shorturl.at/ahtGN

Let me know if you have any other ideas for simple JavaScript projects! This was a fun first step into more complex front-end development.

--

--

Ashwin Upadhyay
Ashwin Upadhyay

Written by Ashwin Upadhyay

0 Followers

Junior Year at SPPU | Passionate Learner | Machine Learning, Web Dev, Design Thinking | Ready to Disrupt & Grow