Password Generator: How Random Passwords Work and How Strong Yours Is
By FindMySum · Last reviewed
A password generator does one job: it picks characters at random so that nobody, including you, can predict the result. That sounds trivial, but the details decide whether the password is actually unpredictable. This article explains how a good generator draws its characters, how to turn the settings into a strength figure in bits, how the time-to-crack estimates on the page are worked out, and what the current US federal guidance (NIST SP 800-63B-4, published in 2025) says about length and composition.
Where the randomness comes from
Ordinary random functions in programming languages, such as JavaScript's Math.random(), are designed for games and simulations. They are fast and statistically even, but their output can be predicted by someone who sees enough of it. Passwords need a cryptographically secure source instead. Browsers provide one through the Web Crypto API: crypto.getRandomValues() fills an array with random numbers taken from the operating system's secure generator, the same source used to create encryption keys.
The calculator asks for random 32-bit numbers and turns each into a position in the character pool. A naive way to do that is to take the remainder after dividing by the pool size, but because 2³² is not a multiple of 94, a few characters would come up very slightly more often than others. This is called modulo bias. The generator avoids it with rejection sampling: any random number above the largest multiple of the pool size is thrown away and another is drawn. Every character in the pool is then exactly as likely as every other.
From settings to bits of entropy
If each of L characters is drawn independently from a pool of N characters, there are N^L possible passwords. Entropy is the base-2 logarithm of that number:
H = log₂(N^L) = L × log₂(N)
The pool sizes are 26 lowercase letters, 26 uppercase letters, 10 digits and 32 symbols, the printable punctuation on a US keyboard. With all four types on, N = 94 and each character is worth log₂(94), about 6.55 bits.
The default setting also requires at least one character of each chosen type. A password that misses a type is thrown away and redrawn, so slightly fewer passwords are possible. The calculator counts the survivors exactly using inclusion and exclusion: start with all 94^L strings, subtract those missing each type, add back those missing each pair of types, and so on.
A worked example with the default settings
The calculator opens with a 16-character password using all four character types, one of each required.
- Without the one-of-each rule there would be 94^16 passwords, which is 16 × 6.55 = 104.87 bits.
- After removing strings that miss a type, about 2^104.59 remain, so the generator's output has 104.59 bits of entropy. The rule costs about 0.3 bits.
- That is roughly 10^31.5 possible passwords.
To estimate how long an attacker would need, assume they have stolen a database of password hashes and are guessing offline. On average they hit the right password after trying half of the possibilities. Using the published hashcat benchmark for a single RTX 4090 graphics card against MD5, a fast and outdated hash, of about 164.1 billion guesses per second:
time = (2^104.59 ÷ 2) ÷ 164.1 × 10⁹ ≈ 9.3 × 10¹⁹ seconds, about three trillion years.
Against bcrypt at cost 5, a deliberately slow hash that runs at about 184,000 guesses per second on the same card, the figure rises to around 2.6 × 10¹⁸ years. Either way, a random 16-character password is not going to be guessed; the realistic threats are phishing, malware and reuse of the same password on another site that gets breached.
How length and character types trade off
Because entropy is length times bits per character, length usually wins. Each extra character from the full pool adds 6.55 bits. Dropping symbols takes the pool from 94 to 62 characters and costs about 0.6 bits per character, so an 18-character password of letters and digits (107 bits) is a little stronger than the 16-character default with symbols. Lowercase letters alone give 4.7 bits per character, and 23 of them (108 bits) beat the default setting.
Avoiding look-alike characters (lowercase l, uppercase I and O, and the digits 0 and 1) shrinks the pool to 89 and costs under 0.1 bits per character. It is worth it for any password you will read off paper or type on a TV remote.
Passphrases of random words
Switch the generator to passphrase mode and it picks whole words instead of characters. The words come from EFF's Long Wordlist, published by the Electronic Frontier Foundation in 2016 for dice-based passphrases and used here under the Creative Commons Attribution 3.0 US licence. It has 7,776 words, which is 6 to the power 5, so five dice rolls pick one word. EFF chose words that are easy to spell and recognise and removed ones that are offensive or easily confused; they are 3 to 9 letters long, about 7 on average.
The maths is the same as for characters, with words in place of characters. Each word is drawn uniformly and independently from 7,776, so it adds log2(7,776) = 12.92 bits, and a passphrase of k words has k × 12.92 bits:
- 4 words: 51.7 bits, too few for anything valuable (about three hours against a fast hash on one graphics card).
- 6 words, EFF's suggestion and the default: 77.5 bits, about 7,776^6 ÷ 2 ÷ 164.1 billion = 6.7 × 10¹¹ seconds, or roughly 21,000 years, against the same fast hash.
- 8 words: 103.4 bits, about the same as the 16-character random default.
The separator (hyphen, space, full stop, underscore or nothing) and the capitalisation (all lower case, a capital at the start of each word, or all capitals) are settings rather than random choices, so they apply to every word the same way and add no entropy: an attacker who suspects you used this list will try those variants too. They exist to satisfy sites that insist on a capital or reject spaces. If you want more strength, add a word. The words are loaded only when you choose passphrase mode, picked in your browser with the same crypto.getRandomValues source as the passwords, and never placed in the page's address; the link records only the number of words, the separator and the capitalisation.
Because the shortest EFF words have 3 letters, the shortest possible six-word passphrase with hyphens is 23 characters, well over NIST's 15-character minimum. With no separator, four words can be as short as 12 characters, so the page rates the shortest passphrase your settings could produce.
What NIST SP 800-63B-4 says
The National Institute of Standards and Technology's digital identity guidelines are written for US federal systems, but they have become the reference for password policy everywhere. The 2025 revision says:
- A password that is the only authentication factor must be at least 15 characters. One used only alongside another factor, such as an authenticator app or security key, must be at least 8.
- Sites should allow passwords of at least 64 characters, and accept spaces, all printing ASCII characters and Unicode.
- Sites must not impose composition rules, such as requiring a mix of character types, and must not force periodic changes.
- New passwords must be checked against a blocklist of common, expected or compromised values.
- Failed login attempts on one account must be limited to 100 in a row.
The strength checker on the page follows those rules: it counts Unicode code points as characters, checks the password against the 1,000 most common entries in the UK National Cyber Security Centre's list of breached passwords, and reports which NIST minimum it meets.
Using the generator well
Generate a different password for every account and store them in a password manager rather than trying to remember them. Keep the default length or go longer for important accounts. Copy the password straight into the site's password field and into your manager, then close the page. For the handful of passwords you must type from memory, such as your computer login or the manager itself, a long passphrase of random words is easier to live with than a random string of the same strength.
More questions
Is a passphrase of four random words better than a random string?
It can be just as strong and much easier to type and remember, as long as the words are picked at random from a large list rather than chosen by you. A word list of 7,776 words (the size of the EFF diceware list) gives about 12.9 bits per word, so six random words carry about 77.5 bits, roughly the same as a 12-character random password from the full keyboard. Four words is only about 52 bits, which is too few for a password protecting something valuable.
Can a website see the password this generator makes?
No. The password is created by JavaScript running in your own browser and stays in the page's memory. The page's address only records the settings, such as the length and which character types are on, so sharing the link lets someone else generate their own password with the same settings, not see yours. Reloading or closing the tab discards the password.
Why do some sites reject the symbols in my generated password?
Some older systems only accept letters and digits, or block characters such as quotes, angle brackets or spaces because of how they were built. NIST SP 800-63B-4 says sites should accept all printing ASCII characters and spaces, but not every site follows it. If a site refuses a password, turn symbols off and add four or five characters of length to keep about the same strength.
How often should I change my passwords?
Only when there is a reason to: the site reports a breach, you see a login you don't recognise, or you shared the password with someone. NIST stopped recommending scheduled changes because people respond to them with predictable tweaks (Summer2025! becomes Autumn2025!), which makes passwords weaker, not stronger. A long, unique password per site plus two-factor authentication is a better use of the effort.
What does 'bits of entropy' mean for a password I made up myself?
Strictly, very little. Entropy measures the process that produced a secret, so it is exact for a random generator and only an upper bound for a human choice. A made-up password such as a pet's name with a year on the end has far less real entropy than its length and character mix suggest, because cracking tools try names, words, dates and common substitutions long before they try random strings.
Is 128 bits of entropy ever needed for a password?
Rarely. Around 80 bits already puts an offline attack against a fast hash beyond the reach of any realistic attacker for decades, and most websites store passwords with slow hashes and lock accounts after repeated failures. 128 bits matches the strength of the encryption keys used to protect data, so it is a sensible target for a password manager's master passphrase or an encryption key you type, not for every website login.
Sources
- NIST SP 800-63B-4, Digital Identity Guidelines: Authentication and Authenticator Management (2025)
- Crypto: getRandomValues() method, MDN Web Docs
- Most hacked passwords revealed as UK cyber survey exposes gaps in online security, National Cyber Security Centre
- hashcat v6.2.6 benchmark, NVIDIA GeForce RTX 4090
- EFF's New Wordlists for Random Passphrases, Electronic Frontier Foundation (2016)
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.