Online custom password generator

Online custom password generator

This is an online example on how to create a password generator. This password generator is written using Javascript.
You can combine four parameters to create the password :

  • upper case letter
  • lower case letter
  • number
  • special character

The minimum length requirement for a strong password is 13 characters. For an Active Directory environment this length will protect you from brute force attack using the free and downloadable Rainbow Tables. You can find here an example on how to test your Active Directory user password strength.

The complexity requirements for a password in the Active Directory domain is the following:

  • Not contain the user’s account name or parts of the user’s full name that exceed two consecutive characters
  • Be at least six characters in length
  • Contain characters from three of the following four categories:
  • English uppercase characters (A through Z)
  • English lowercase characters (a through z)
  • Base 10 digits (0 through 9)
  • Non-alphabetic characters (for example, !, $, #, %)

Complexity requirements are enforced when passwords are changed or created.

With this custom password generator you can set the number of characters and type you want to include in it :

  • Uppercase characters = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”
  • Lowercase characters = “abcdefghijklmnopqrstuvwxyz”
  • Numbers = “0123456789”
  • Special characters = “+-_,;.:?!%=”

Click on the button "Generate Password"


Source code:




The Math.random() function returns a floating-point, pseudo-random number in the range[0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range.  The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user.

Note: Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely thewindow.crypto.getRandomValues() method.





Example: Using Math.random

Note that as numbers in JavaScript are IEEE 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for Math.random() itself) aren't exact.  If extremely large bounds are chosen (253 or higher), it's possible in extremely rare cases to calculate the usually-excluded upper bound.


Specification Status Comment
ECMAScript 1st Edition. JavaScript 1.0 (UNIX Only) / JavaScript 1.1 (All platform) Standard Initial definition.
ECMAScript 5.1 (ECMA-262)
The definition of 'Math.random' in that specification.
ECMAScript 6 (ECMA-262)
The definition of 'Math.random' in that specification.


Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By :
%d bloggers like this: