Password Generator
Create strong, cryptographically random passwords with the character types and length you choose.
About the Password Generator
Passwords are built from crypto.getRandomValues rather than Math.random(), which matters because only the former is a cryptographically secure source, making the output actually fit for real account security. Every character category you turn on is guaranteed to show up at least once, and the result gets shuffled before it's displayed, all without a single byte leaving your device.
Why Math.random() genuinely isn't safe for passwords
Math.random() is a fast, general-purpose pseudo-random number generator, not a cryptographically secure one, and that's a meaningful, well-documented distinction, not a technicality. Several JavaScript engines have publicly known, reversible algorithms behind Math.random() (V8's xorshift128+, for instance), meaning someone who observes enough of its output sequence can, in principle, predict future values from it. crypto.getRandomValues() instead draws from the operating system's cryptographically secure random number generator, specifically designed so that observing any amount of its output gives no meaningful advantage in predicting what comes next. For anything protecting a real account, that distinction is the entire point.
How the generator guarantees every selected category appears
Rather than picking every character purely at random from the combined pool (which could, by chance, produce a password with no symbols even though you asked for symbols), this tool first picks one random character from each category you've enabled, guaranteeing at least one of each, then fills the remaining length from the full combined pool, then shuffles the entire result using a Fisher-Yates shuffle before displaying it. Worth being precise about the tradeoff: this "guarantee one from each category first" approach isn't perfectly identical, statistically, to picking every character with pure uniform randomness across the whole pool, a small number of positions are constrained to come from a specific category before the shuffle happens. In practice, for any realistic password length, this has no meaningful impact on actual guessing resistance, but it's a genuine, honest distinction from theoretically perfect uniform randomness.
Why the shuffle uses this specific loop structure
The shuffle function walks the array from the last index down to the second, and at each step swaps the current position with a randomly chosen earlier-or-equal position. That specific pattern, known as a Fisher-Yates shuffle, is what makes it an unbiased random permutation, every possible ordering of the characters is equally likely to result. Simpler-looking shuffle implementations (like sorting an array with a random comparator) are a common but genuinely biased alternative that doesn't actually produce a uniform random order, which is why this specific, well-established algorithm is used here instead.
What the strength meter is actually measuring
The strength bar isn't calculating true information-theoretic entropy (which would be length × log2(pool size) bits), it's a simpler rule-based score built from length thresholds (8, 12, 16 characters) and how many character categories you've enabled. That makes it a reasonable at-a-glance guide, longer and more varied is genuinely stronger, but it shouldn't be read as a precise entropy calculation. A 20-character password using only lowercase letters, for instance, may score lower here than a 12-character password mixing all four categories, even though the longer password can still carry more actual entropy depending on the exact numbers, since the meter weights variety and length as separate simple checkboxes rather than combining them mathematically.
Why "ambiguous characters" specifically means l, 1, I, O, 0
These five characters are grouped together because they're visually similar or outright identical in many fonts and handwriting, lowercase L, uppercase I, and the digit 1 can look nearly indistinguishable, and uppercase O is easily confused with the digit 0. The exclusion option exists for situations where a password might need to be read aloud, handwritten, or manually typed from a printed sheet rather than always copy-pasted, contexts where that visual ambiguity can genuinely cause transcription errors.
Frequently Asked Questions
Why does this generator use crypto.getRandomValues() instead of Math.random()?
Math.random() is a fast general-purpose generator with publicly known, sometimes reversible algorithms behind it in several JavaScript engines. crypto.getRandomValues() draws from the operating system's cryptographically secure random source, where observing prior output gives no advantage in predicting future values, essential for anything protecting a real account.
Does the generator guarantee every character type I select actually appears?
Yes, it picks one random character from each enabled category first, then fills the remaining length from the combined pool, then shuffles everything. This guarantees representation from every selected category rather than leaving it to chance.
Is the guaranteed-category approach exactly as random as pure uniform selection?
Not perfectly, in a strict statistical sense, a small number of positions are constrained to come from a specific category before shuffling. For any realistic password length this has no meaningful impact on actual guessing resistance, but it is a genuine, honest distinction from theoretically perfect uniform randomness.
Does the strength meter calculate real password entropy?
No, it uses a simpler rule-based score from length thresholds and category count rather than the mathematical entropy formula (length times log2 of pool size). It's a reasonable at-a-glance guide, but not a precise entropy calculation.
Why does the shuffle use that specific loop pattern instead of something simpler?
It's a Fisher-Yates shuffle, which produces a genuinely unbiased random permutation where every possible character ordering is equally likely. Simpler-looking alternatives, like sorting with a random comparator, are a common but statistically biased approach that doesn't achieve true uniform randomness.
Which characters count as "ambiguous" and why?
l (lowercase L), 1, I (uppercase i), O (uppercase o), and 0 are grouped together because they look similar or identical in many fonts and handwriting. Excluding them helps when a password needs to be read aloud, handwritten, or manually typed rather than copy-pasted.