Password Generator

Generate secure passwords using the Web Crypto API.

Character sets

How this tool generates secure passwords

This tool uses the Web Crypto API (window.crypto.getRandomValues), available in all modern browsers, which produces cryptographically secure random numbers — that is, unpredictable by design, unlike JavaScript's Math.random(), which uses a simple pseudorandom generator not suited for cryptography.

In addition, the algorithm guarantees no modulo bias: when choosing a character from the alphabet, values outside the largest multiple of the alphabet size are rejected and a new value is drawn. This ensures a uniform distribution among all possible characters. The result is then shuffled with Fisher-Yates using the same cryptographic source, guaranteeing at least one character from each selected set.

What is password entropy?

Entropy is a measure of a password's unpredictability, expressed in bits. The basic formula is:

entropy (bits) = length × log₂(alphabet size)

For example, a 16-character password using uppercase + lowercase + numbers (62-symbol alphabet) has entropy of 16 × log₂(62) ≈ 95 bits. With symbols added (alphabet ~90), it rises to about 102 bits.

Entropy range Rating Typical use
Below 40 bits Weak Avoid in any real context
40–59 bits Medium Acceptable for low-risk contexts
60–127 bits Strong Recommended for accounts and systems
128 bits or more Very strong Standard for cryptography and critical systems

Tips for more secure passwords

Frequently Asked Questions (FAQ)

Why use crypto.getRandomValues instead of Math.random?

Math.random() uses a pseudorandom generator (PRNG) designed for speed, not security. On some engines, its state can be inferred from previous outputs. window.crypto.getRandomValues uses the operating system's entropy source (equivalent to /dev/urandom on Linux), suitable for cryptographic use.

What is modulo bias and how is it avoided?

If the alphabet size isn't an exact divisor of the random number's range (0–255 for a byte, for example), some characters appear with slightly higher probability — this is called modulo bias. This tool rejects values outside the largest multiple of the alphabet size and draws again, guaranteeing a perfectly uniform distribution.

What are ambiguous characters?

These are visually similar characters that can cause confusion when transcribing passwords manually: 0 (zero) and O (letter O), 1 (one), l (lowercase L) and I (uppercase i). The Avoid ambiguous characters option removes them from the alphabet, slightly reducing entropy but making manual transcription easier when needed.

Is the displayed entropy a security guarantee?

Entropy indicates the password's theoretical unpredictability, assuming the generator is truly random. It does not account for side-channel attacks or device compromise. It is a useful, well-founded metric, but does not replace good general security practices.

Can I use this tool to generate production passwords?

Yes — generation is cryptographically secure. However, remember that the responsibility for storing and using the password securely is yours. Use a password manager to store generated passwords, never store them in plain text.