Password Generator

Generates a password with your browser's cryptographic random source (crypto.getRandomValues) and shows how strong it is as entropy and an estimated crack time. Nothing is sent to a server or stored.

-
Estimated strength: -Character pool: -Average crack time (10 billion guesses/s): -

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 chars8 chars10 chars12 chars16 chars20 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

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

Limits of this tool, and when not to use it

What to do after generating

  1. 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.
  2. Turn on two-step verification, so a leaked password is not the end of the story.
  3. Replace the same password on any other site where you used it.
  4. 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.