How this generator builds a password
When you press the button, the browser asks the operating system's secure random source for values through crypto.getRandomValues(), and the script uses them to pick characters one at a time. For every character type you tick, one character of that type is placed first, so a password built from four types always contains all four. The remaining positions are drawn from the combined pool of every selected type, and the whole result is then shuffled so the guaranteed characters do not sit at predictable positions.
Two classic mistakes occur when random numbers are turned into characters, and this script avoids both. First, taking a 32-bit random number modulo the pool size makes the early characters very slightly more likely whenever the pool size is not a power of two. The script instead discards values from the biased tail and draws again (rejection sampling), so each character has exactly the same probability. Second, reusing the same random numbers for picking and for shuffling links the two steps and reduces the effective randomness. The Fisher-Yates shuffle here draws a fresh random number for every swap.
Reading the entropy and crack-time numbers
Entropy tells you how many guesses an attacker would need if they knew how the password was made. With a character pool of size N and length L, where every character is drawn independently and uniformly, there are N^L possible passwords and the entropy is L x log2(N) bits. Each extra bit doubles the count. On average the attacker finds the password after trying half of the possibilities, so the average time is 2^(bits - 1) / guesses per second. Everything on this page assumes 10 billion guesses per second, a rough model of a stolen password file protected only by a fast hash and attacked offline with several GPUs. Real speeds can differ by factors of thousands: a deliberately slow password hash such as bcrypt or Argon2 makes each guess far more expensive, while an online login with lockouts allows only a handful. Use the times as a common ruler for comparing settings, not as a lifetime forecast.
Entropy and average crack time by character mix and length
The table is computed at build time. For each cell, the top line is the entropy in bits and the bottom line is the average time at 10 billion guesses per second. It uses the full character pool without removing look-alike characters (26 uppercase, 26 lowercase, 10 digits, 18 symbols) and assumes independent, uniform draws.
| Character mix (pool size) | 6 chars | 8 chars | 10 chars | 12 chars | 16 chars | 20 chars |
|---|---|---|---|---|---|---|
| Digits only (10) | 20 bits under 1 second | 27 bits under 1 second | 33 bits under 1 second | 40 bits 50 seconds | 53 bits 6 days | 66 bits 158 years |
| Lowercase only (26) | 28 bits under 1 second | 38 bits 10 seconds | 47 bits 2 hours | 56 bits 55 days | 75 bits 69,094 years | 94 bits 31.6 billion years |
| Lowercase + digits (36) | 31 bits under 1 second | 41 bits 2 minutes | 52 bits 2 days | 62 bits 8 years | 83 bits 12,609,738 years | 103 bits far beyond the age of the universe (about 13.8 billion years) |
| Upper + lower + digits (62) | 36 bits 3 seconds | 48 bits 3 hours | 60 bits 1 year | 71 bits 5,112 years | 95 bits 75.5 billion years | 119 bits far beyond the age of the universe (about 13.8 billion years) |
| Upper + lower + digits + 18 symbols (80) | 38 bits 13 seconds | 51 bits 23 hours | 63 bits 17 years | 76 bits 108,879 years | 101 bits far beyond the age of the universe (about 13.8 billion years) | 126 bits far beyond the age of the universe (about 13.8 billion years) |
The pattern to notice is that length beats variety. Twenty lowercase letters (94 bits) come from a pool of only 26, yet they exceed ten characters drawn from all 80 symbols (63 bits). One more character multiplies the number of possibilities by the pool size, while widening the pool only adds to a logarithm.
Three worked examples
Example 1: the default (16 characters, all four types)
With look-alike characters excluded, the pool is 24 uppercase + 25 lowercase + 8 digits + 18 symbols = 75 characters. The entropy is 16 x log2(75) = 100 bits, and the average time at 10 billion guesses per second is far beyond the age of the universe (about 13.8 billion years). (The rule that each selected type must appear at least once makes the true count of passwords a hair smaller, but at 16 characters the difference is negligible.)
Example 2: 12 lowercase letters and digits, look-alikes removed
The pool is 25 + 8 = 33 characters, so 12 x log2(33) = 61 bits and the average time is 3 years. That is comfortable for an online login with lockouts, but for an important account whose password hash could leak, prefer 16 characters or more.
Example 3: a six-digit PIN
Ten possible digits and six positions give 6 x log2(10) = 20 bits, exactly one million combinations. Offline that falls in under 1 second, yet a service that locks after five wrong attempts makes the same PIN practical to use. The same secret can be weak or adequate depending on how fast an attacker can guess.
Suggested settings
- Email, banking, cloud storage and other core accounts: 16 characters or more with all four types, stored in a password manager, plus two-step verification.
- Ordinary shops and forums: 12 to 16 characters, and a different one for every site. If one site leaks a reused password, attackers try it everywhere else (credential stuffing).
- Sites that reject symbols or allow only some: untick symbols and add four to six characters to compensate.
- Passwords you must type by hand (TV, console, Wi-Fi): keep "exclude look-alike characters" on so capital I, lowercase l and the digit 1, or capital O and zero, cannot be confused. Add a character or two to make up for the smaller pool.
- A master password you must memorize: several random words are easier to remember than random symbols. Try the Passphrase Generator.
Length and randomness matter more than composition rules
Rules such as "one capital, one digit, one symbol" tend to produce Password1! and Summer2024! when people choose the password themselves. Attackers have those patterns (a word, digits, a symbol at the end, letters swapped for look-alike symbols) built into their tools and try them first. The NIST digital identity guidelines (SP 800-63B) lean toward allowing long passwords, checking choices against lists of known-compromised passwords, and avoiding forced composition rules and routine expiry, though the exact minimum lengths changed between revisions, so check the current text if you set policy. A randomly generated string has no human habits to exploit, which is the real difference.
Common mistakes and myths
- "Adding symbols makes it safe."
P@ssw0rd!has three symbols and is among the first things a cracking tool tries. Randomness is what counts. - "I have to memorize what the generator gives me." You do not. Let a password manager remember it and keep only one master password in your head.
- "Change it every month." Changing immediately after a suspected leak is the useful part. Forced rotation tends to produce weak increments such as a bumped number at the end.
- Reading the crack time as a fact. It is a model with stated assumptions. The hash used by the service, rate limits and whether the file has leaked all change reality.
- Saving a generated password in a chat or notes app in plain text. This is a very common leak path. Paste it into your password manager, then overwrite the clipboard with something else.
Limits of this tool, and when not to use it
- The generator runs only inside the page, but a malicious browser extension or malware on the device can still read what is shown. Do not use it on a machine you suspect is compromised.
- If a service allows only certain symbols or caps the length (say, 12 characters), adjust the options. Some of the 18 symbols used here may be rejected by a given site.
- Entropy is meaningful only for a password that was generated randomly and left unchanged. If you edit the result to make it easier to remember, the calculation no longer applies.
- Encryption keys and API tokens are a different case: follow the recommended generation method of the system that consumes them, such as 32 random bytes.
What to do after generating
- Save the password in your password manager first, then paste it into the site's change-password form. Doing it the other way around risks closing the tab before it is saved and locking yourself out.
- Turn on two-step verification, so a leaked password is not the end of the story.
- Replace the same password on any other site where you used it.
- To gauge a password you already have, use the Password Strength Checker, ideally with a look-alike string rather than the real one.
Related: the Hash Generator shows how stored passwords become hashes, and the UUID Generator makes random identifiers.
Frequently Asked Questions
Is the generated password stored or sent to a server?
No. Generation happens entirely in your browser and the value disappears when you close or reload the page. The script has no code that sends it anywhere and does not write it to browser storage. Copying it, of course, puts it on your clipboard.
How long should a password be?
With all four types (look-alikes excluded, the default), a random 12-character password is about 75 bits and a 16-character one about 100 bits. Use at least 12 characters for general services and 16 or more for email, banking and other core accounts. Compare lengths in the table above.
Why are I, O, l, 0 and 1 excluded by default?
In many fonts capital I, lowercase l and the digit 1 look almost identical, and O resembles 0. The default reduces typing errors for passwords you must enter by hand. Unticking the option draws from the full pool of 80 characters; a small drop in pool size is easily made up with one or two extra characters.
How is this different from a password made with Math.random()?
Math.random() is built for statistical spread, not security, and in many engines its internal state can be inferred from observed output. crypto.getRandomValues() draws on the operating system's secure random source and is designed so that predicting the next value is infeasible.
Is a long password fine to reuse on several sites?
No. Length defends against brute force, but if one site stores or leaks the password in plain text or with a weak hash, attackers simply try that exact value elsewhere. Use a different password on every site regardless of length.
This article is general information and does not replace your organization's security policy or professional advice.