Cryptographically Secure Password Generator

Generate high-entropy random passwords, Diceware passphrases, and numeric PINs using Web Crypto CSPRNG with real-time Shannon entropy and crack-time evaluation.

Setting secure passwords often faces two pitfalls: relying on predictable personal phrases, or creating short "complex" strings using weak pseudo-random generators that modern GPU cracking rigs exhaust in minutes. Worse yet, some online generators transmit generated passwords across the network, introducing critical interception risks.

This tool approaches password security from first principles. It relies exclusively on the browser's cryptographic random source (crypto.getRandomValues) and eliminates modulo bias through rejection sampling. Choose between custom character pools, memorable Diceware passphrases, banking PINs, or pronounceable phonetic strings, while viewing real-time Shannon entropy (bits) and estimated brute-force resistance.

Information entropy as the physical metric of password strength

Password resistance against brute-force attacks is determined by the size of the search space. Under Shannon information theory, entropy H = L * log2(N), where L is the length and N is the character pool size. An 8-character password using upper, lower, and digits yields only 8 * log2(62) approx 47.6 bits of entropy, crackable within hours by modern GPU clusters. By contrast, a 4-word passphrase (such as correct-horse-battery-staple) surpasses 52 bits of entropy while remaining effortless for humans to memorize.

Why memorable word phrases outperform short complex strings

Human memory struggles with artificial strings like Tr0ub4dor&3, prompting people to write them down or reuse them across services. The Diceware method chains common dictionary words together, leveraging the exponential compounding effect of length on entropy. For accounts requiring manual typing, a multi-word passphrase delivers both effortless recall and superior cryptographic resistance.

CSPRNG and rejection sampling: eliminating modulo bias

Standard Math.random() in JavaScript uses algorithms like xorshift128+, which are not cryptographically secure and allow attackers to reconstruct internal states from observed sequences. This tool calls crypto.getRandomValues() directly from the OS entropy pool. Furthermore, when the pool size N does not evenly divide 256 or 2^32, applying a modulo operator (% N) skews character probabilities toward earlier indices. This tool enforces rejection sampling to discard remainder-biased values and guarantee uniform distribution.

Shoulder-surfing protection and batch generation

In shared offices or screen sharing sessions, plain text passwords risk being captured by bystanders or recorded meetings. This tool provides a one-click masking toggle to obscure passwords with dots. It also supports batch generation with individual and batch clipboard copying for DevOps engineers initializing database credentials or test accounts, completely offline with zero network requests.

Advertisement

Frequently asked questions

Why is Math.random() insecure for password generation?
Math.random() is built for speed in games and simulations, not security. Its internal state has limited period and no resistance to reverse-engineering. An attacker who sees a few consecutive values can calculate the internal seed and predict all upcoming passwords. Secure generation requires cryptographically secure pseudo-random number generators (CSPRNG) via window.crypto.
Is an 8-character complex password better than a 4-word passphrase?
No, a 4-word passphrase is significantly more secure. An 8-character password using all keyboard symbols offers roughly 94^8 approx 6x10^15 combinations (about 52 bits of entropy), vulnerable to multi-GPU offline cracking. Four words chosen from a curated list of thousands yield far greater combination spaces, while being easy to type and impossible to forget.
Are generated passwords sent or logged to any remote server?
Never. This website is a purely static client-side application without any backend API. All generation algorithms (CSPRNG, Fisher-Yates shuffle, entropy analysis) execute inside your local browser memory and are discarded as soon as the page is closed.
What is modulo bias and why does it matter?
When mapping a random byte (0 to 255) onto a pool of 62 alphanumeric characters, 256 divided by 62 gives 4 with a remainder of 8. If calculated simply as byte % 62, the first 8 characters have a 25 percent higher chance of being selected than the remaining characters. Attackers exploit these statistical skews to optimize dictionary attacks. Rejection sampling eliminates this by discarding numbers that fall within the remainder margin.

Related tools

Advertisement