Password advice is full of folklore: use at least one uppercase letter, one digit and one symbol; avoid dictionary words; change it every 90 days. Some of that is useful, some is outdated, and most of it misses the variable that matters most: how much unpredictability the password contains.

Entropy, not vibes

Entropy is measured in bits. For a password drawn uniformly from an alphabet of size N with length L, the entropy is approximately L × log2(N).

Length Lowercase only (26) Alphanumeric (62) Printable ASCII (95)
8 38 bits 48 bits 52 bits
12 56 bits 71 bits 79 bits
16 75 bits 95 bits 105 bits
20 94 bits 119 bits 131 bits
32 150 bits 190 bits 210 bits

These numbers assume the characters are chosen randomly and independently. A “16-character password” made of words and lemmas has far less entropy than the table suggests. The table describes a generator, not a human.

Length beats complexity

Adding a symbol class increases N modestly: from 62 to 95 is about 0.6 bits per character. Adding one character increases entropy by log2(N), which is 5.95 bits for the alphanumeric set. One extra character is worth more than adding symbols, and it is easier to type and paste.

This is why “correct horse battery staple” style passphrases work: four to six random words from a large list produce high entropy with a structure humans can remember. The tradeoff is length and typing effort.

Character-class rules

Sites often require one uppercase, one lowercase, one digit and one symbol. These rules do not add much entropy, and they can reduce it if users respond predictably: capitalize the first letter, append 1, add ! at the end. A generator that enforces the rules can still be strong if the remaining characters are random, but the rules are not the source of strength.

Excluding ambiguous characters (0, O, 1, l, I) helps when a password is read aloud or transcribed. It slightly reduces the alphabet; for digital use, the benefit is small.

Use a CSPRNG

The random source matters. Math.random() is not cryptographically secure: its internal state can be reconstructed from a modest number of outputs, which makes generated passwords predictable to an observer. Use crypto.getRandomValues in the browser, secrets in Python, SecureRandom in Java, or crypto.randomBytes in Node.

A password manager's generator is usually the best choice because it combines a CSPRNG with secure storage and autofill, reducing the chance that the password is exposed in a clipboard or a screenshot.

Storage and handling

Generating a strong password is only half the problem:

  • Store it in a password manager, not a note app or a repo.
  • Hash server-side passwords with bcrypt, scrypt or Argon2; never store plaintext.
  • Compare hashes in constant time where relevant.
  • Use TLS; a strong password sent over HTTP is still exposed.
  • Never log passwords, tokens or reset links.
  • Use a separate secret for API tokens; do not reuse the account password.

Rotation and reuse

Mandatory periodic rotation is out of favor because it pushes users toward predictable patterns and does not address the main risk: credential reuse and breaches. Better rules:

  • Rotate after a confirmed compromise, not on a calendar.
  • Use unique passwords per site, or at least per security domain.
  • Enable two-factor authentication where available.
  • Prefer passkeys or hardware keys for high-value accounts.

A practical recipe

  1. For most accounts, generate 16–20 characters from a mixed alphabet.
  2. For high-value accounts, use 20+ characters or a six-word passphrase.
  3. Exclude ambiguous characters only if transcription is part of the workflow.
  4. Store the result in a password manager and enable 2FA.
  5. For machine secrets, use at least 128 bits of entropy and treat the value as a secret.

The password generator uses crypto.getRandomValues, reports estimated entropy, and lets you exclude ambiguous characters. It runs locally; nothing is sent to a server. That solves generation, not storage: the password manager and the server-side hash still matter.