DevToolsmith

Password Generator

Generate strong random passwords and diceware passphrases in your browser. Every character comes from a cryptographically secure random source, and the entropy meter shows how long a brute-force attack would take.

Runs 100% in your browser — nothing is uploaded

Characters

very strong · 129.4 bits of entropy · time to guess at 100 billion guesses per second (one GPU against a fast hash like MD5): longer than the age of the universe

How strong is strong enough?

The time to crack depends on how the site stores passwords. A leaked database of fast, unsalted hashes like MD5 can be attacked at around 100 billion guesses per second on a single modern GPU. bcrypt at cost 12 slows even a rack of GPUs to well under 100,000 guesses per second. Times below are the average for random passwords:

PasswordEntropyFast hash (10^11/s)bcrypt (10^5/s)
8 characters, all types 52 bits 5 hours 624 years
12 characters, all types 78 bits 39 thousand years 39 billion years
16 characters, letters and digits 95 bits 8 billion years longer than the age of the universe
20 characters, all types 130 bits longer than the age of the universe longer than the age of the universe
4-word passphrase 41 bits 14 seconds 163 days
6-word passphrase 62 bits 274 days 751 thousand years
8-word passphrase 83 bits 1 million years longer than the age of the universe

Online attacks against a login form are far slower because of rate limiting, so the real risk is a database leak. Use a different password for every site, so one leak doesn’t unlock the others.

How the generator works

  • Secure randomness. Characters are picked with crypto.getRandomValues, never Math.random(), which is predictable.
  • No modulo bias. A random 32-bit number taken modulo the pool size would make some characters slightly more likely. Values that would cause this are rejected and drawn again.
  • Fair “one of each type”. When every chosen character type must appear, passwords that miss one are thrown away and regenerated. Forcing a character into a random position instead would make the result easier to guess.

Generating passwords in code

Python
import secrets, string

alphabet = string.ascii_letters + string.digits + string.punctuation
password = ''.join(secrets.choice(alphabet) for _ in range(20))

# URL-safe token for reset links, API keys, etc.
token = secrets.token_urlsafe(32)
JavaScript (browser and Node.js)
function randomPassword(length = 20) {
  const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*';
  const limit = 2 ** 32 - (2 ** 32 % alphabet.length); // avoid modulo bias
  const out = [];
  const buf = new Uint32Array(1);
  while (out.length < length) {
    crypto.getRandomValues(buf);
    if (buf[0] < limit) out.push(alphabet[buf[0] % alphabet.length]);
  }
  return out.join('');
}
Shell
openssl rand -base64 24      # 32 random characters
pwgen -sy 20 1               # if pwgen is installed

Storing passwords? Never store them as plain text or a fast hash like SHA-256. Use a slow password hash such as bcrypt or Argon2. You can try bcrypt with the bcrypt generator. For API keys and JWT secrets, use the secret key generator.

Frequently asked questions

Is this password generator safe to use?

Passwords are generated in your browser with crypto.getRandomValues, the same cryptographically secure random source used for encryption keys. Nothing is sent over the network, stored or logged, and generated passwords are never put in the URL. You can disconnect from the internet after the page loads and it keeps working.

How long should a password be?

For accounts protected by a password manager, use 16 to 20 random characters; it costs you nothing because you never type it. For passwords you must remember, like the manager’s master password or your computer login, a passphrase of 6 or more random words is both stronger and easier to type than 12 random characters. NIST SP 800-63B asks services to allow at least 64 characters.

What is a diceware passphrase?

A passphrase made of words picked at random from a fixed list, originally by rolling dice. This tool uses the EFF short wordlist of 1,296 short, distinct words, so each word adds 10.3 bits of entropy. Six words give about 62 bits. The strength comes from the random choice, so never pick or rearrange the words yourself.

What does entropy mean?

Entropy measures how many guesses an attacker needs, in bits: n bits means 2^n possibilities. The meter counts passwords allowed by the selected length, exclusions and requirement to include every selected character type. That is why it is only meaningful for random passwords: “P@ssw0rd!” looks complex but is in every cracking dictionary.

Do I need symbols in my password?

Not for strength. Length matters far more: adding 4 characters adds more entropy than adding symbols to the pool. Current NIST guidance tells services not to require mixtures of character types. Some sites still demand a symbol or a digit, which is what the options here are for. If a site rejects certain characters, list them in Exclude characters.