What makes a password actually strong
Password strength is a specific mathematical property called entropy, measured in bits. Every extra bit doubles the number of guesses an attacker has to try. The formula is simple: entropy = length × log2(charset_size).
A few reference points for a completely random password (no dictionary words, no patterns):
- 8 characters, lowercase letters only — 37 bits of entropy. Breakable in under a minute on modern GPU hardware.
- 8 characters, full mixed case + digits + symbols — 52 bits. Still breakable in a few hours against a fast offline attack.
- 12 characters, full mix — 78 bits. Safe against current offline attacks for most threat models.
- 16 characters, full mix — 105 bits. Safe against any realistic offline attack for the foreseeable future.
- 20+ characters, full mix — 131+ bits. Overkill for most things, but cheap, so why not.
The takeaway: for anything that matters, aim for at least 16 characters with mixed case, digits, and symbols. 12 is the minimum floor.
Why this generator uses Web Crypto
Every character in a password generated here comes from crypto.getRandomValues(), the browser's cryptographically secure pseudo-random number generator. That matters — and it's the reason this tool exists instead of a one-liner with Math.random().
Math.random() is a pseudo-random number generator, not a CSPRNG. It's fine for games, animations, and shuffling a deck of cards — but it's never safe for anything related to security. Its output is deterministic given the seed, the internal state can be recovered from a few observed outputs, and it's not designed to resist a motivated attacker. Passwords generated with Math.random() are guessable.
crypto.getRandomValues() is backed by the operating system's entropy source — the same one that generates TLS session keys, SSH host keys, and the random values used inside HTTPS itself. If this API isn't secure, you have bigger problems than a weak password.
Random strings vs passphrases
There's a long-running debate, famously captured in the xkcd #936 comic, about whether you should use a random string like Tr0ub4dor&3 or a passphrase like correct horse battery staple. The honest answer: it depends on whether you have to type it.
- Random strings are maximally dense — every character adds the full log2(charset) bits. Fine when a password manager is filling the field for you. Painful when you're typing on a phone keyboard.
- Passphrases (four to six random words from a large wordlist) are easier to memorise and type. A 5-word passphrase drawn from a 7,776-word list (the EFF long list) is around 64 bits of entropy — enough for most things, and you can actually remember it.
If you use a password manager for everything, generate maximum-entropy random strings and never type them. If you're picking your vault's master password, consider a passphrase — it's the one you'll actually have to type.
Common mistakes that make strong passwords weak
- Dictionary words, even with substitutions.
P@ssw0rd!is not meaningfully stronger thanpasswordagainst a modern cracker. Every common substitution (a→@,o→0,s→$) is already in every crack-tool wordlist. - Keyboard patterns.
qwerty123,asdfghjkl,1qaz2wsx— all in the top few thousand of any leaked password dump. - Personal information. Birthdays, pet names, and hometown names show up in social engineering attacks and leaked data. Even if you think it's not public, treat it as if it were.
- Reusing the same password on multiple sites. This is by far the biggest real-world risk. One breach at a low-security site exposes every account that shares the password. Use a password manager.
- Short passwords with complexity rules. An 8-character "Password1!" is not meaningfully stronger than "password". Length beats complexity every time.
How to store what you generated
Once the password is generated, it needs to get somewhere safe — and "somewhere safe" has very few answers:
- Password manager. 1Password, Bitwarden, KeePass, or the one built into your browser. This is the right answer 99% of the time. The manager encrypts everything with a single master password (which should itself be a long passphrase) and fills fields automatically so you never type the generated one.
- Paper, in a physical location you control. Old-school but legitimate for backup codes and vault master passwords. The threat model for a piece of paper in your desk drawer is very different from the threat model for an online account.
- Never in plain text on disk. Not a
.txtfile, not a Notes app without encryption, not a draft email to yourself. - Never in chat, email, or SMS. Every one of these services makes backups, and every backup is another place the password could leak.
If you do nothing else after reading this, install a password manager — any of them, the free tiers are fine — and start generating unique passwords per site. That single change eliminates the credential-stuffing risk that accounts for the majority of successful account takeovers.
Related security tools on CodeBoxTools
- Hash Generator — SHA-256, SHA-1, SHA-384, SHA-512 hashes via Web Crypto.
- Bcrypt Generator — the right way to hash a password on the server side, with adjustable cost factor.
- UUID Generator — cryptographically-random identifiers for tokens, sessions, and API keys.
- JWT Decoder — inspect JSON Web Tokens from your auth flows.
- Base64 — decode basic-auth and data-URL payloads.