SecurityMar 29, 2026 · Updated Oct 13, 2026 · 4 min read

How to Generate a Secure Password

Verizon's 2025 Data Breach Investigations Report found compromised credentials were the initial way in for 22% of the 12,195 breaches it analyzed — the most common single vector — and reused or predictable passwords are what make stolen and guessed credentials work. A randomly generated password with sufficient length and character variety is exponentially harder to crack than anything a human would choose. Understanding why — and how to generate them properly — is fundamental to personal and application security.

🔐
Try the Password Generator
Free, no signup
→
DG
Derek Giordano
Designer & Developer
In this guide
01Why Random Passwords Matter02Understanding Password Entropy03Length vs Complexity04Worked Example: The Bias Hiding in a Common Snippet05Passphrases: The Best of Both Worlds

Why Random Passwords Matter

Human-chosen passwords follow predictable patterns: dictionary words, personal information (birthdays, pet names), keyboard walks (qwerty, 123456), and common substitutions (p@ssw0rd). Attackers know these patterns and build dictionaries specifically targeting them. A randomly generated password has no pattern to exploit — the only attack is brute force, which becomes impractical with sufficient length and character variety.

Understanding Password Entropy

Entropy measures the unpredictability of a password in bits. A password with N bits of entropy has 2^N possible combinations. The formula is: entropy = length × log2(character pool size). A 12-character password using uppercase, lowercase, digits, and symbols (95 characters) has about 79 bits of entropy — meaning 2^79 (roughly 604 sextillion) possible combinations. At 100 billion guesses per second, cracking it would take over 190,000 years. The Password Generator shows the entropy of each generated password.

Length vs Complexity

Length contributes more to entropy than character variety. A 20-character password using only lowercase letters (about 94 bits) is stronger than a 10-character password using all 95 printable characters (about 66 bits). NIST's current Digital Identity Guidelines (SP 800-63B-4, 2025) reflect this: services must require at least 15 characters for passwords used on their own (8 when used with another factor), should allow at least 64, and must not impose composition rules such as "one symbol and one digit" or force periodic changes.

Worked Example: The Bias Hiding in a Common Snippet

Entropy figures assume every character is equally likely. A snippet copied all over the web breaks that: it takes random bytes from crypto.getRandomValues() and picks a character with byte % pool.length. With 95 characters, 256 = 2 × 95 + 66, so the first 66 characters of the pool come up three times in every 256 bytes and the other 29 only twice. We drew 9.5 million characters each way in Node.js (script in our test folder, October 13, 2026):

byte % 95Rejection sampling
Most / least frequent character1.53×1.01×
Share taken by the first 66 characters (fair: 69.5%)77.4%69.5%

Rejection sampling simply throws away bytes of 190 or more (the largest multiple of 95 below 256) and draws again. The loss in entropy from the biased version is modest for one password, but it is free to avoid; our generator uses rejection sampling, and Math.random() should never be used for passwords at all, because it is not a cryptographically secure generator.

Passphrases: The Best of Both Worlds

A passphrase is a sequence of random words — like 'correct horse battery staple.' A 4-word passphrase drawn from a 7,776-word dictionary (the EFF wordlist) has about 51 bits of entropy. A 6-word passphrase has 77 bits — comparable to a complex 12-character password but far easier to type and remember. The key is that the words must be randomly selected, not chosen by a human. Our Password Generator creates random character passwords; for passphrases, roll dice against the EFF list or use a password manager's passphrase option.

Frequently Asked Questions

How long should a secure password be?+
At least 16 characters for important accounts, with mixed case, digits, and symbols. For passphrases, use at least 5–6 randomly selected words. Length is more important than complexity.
What is password entropy?+
Entropy measures a password's unpredictability in bits. Higher entropy means more possible combinations and longer cracking time. A 12-character mixed password has about 79 bits; a 6-word passphrase has about 77 bits.
Is a passphrase more secure than a password?+
A long passphrase (5–6 random words) has comparable entropy to a complex 12-character password but is easier to type and remember. The words must be randomly selected — not a sentence or phrase you'd naturally say.
Try it yourself

Use the Password Generator — free, no signup required.

⚡ Open Password Generator
DG
Derek Giordano
Written by the creator of Ultimate Design Tools. BA in Business Marketing.
⚡ Try the free CSP Header Builder →