How random password generators work

A password generator does three jobs: get unpredictable randomness, turn it into characters without bias, and never let the result leave your device.

1. Unpredictable randomness

General random functions such as JavaScript's Math.random() are built for speed in games and simulations. Their output can be predicted after enough has been observed, so they must not be used for secrets. Browsers provide crypto.getRandomValues(), a cryptographically secure generator seeded from the operating system, and that is what any trustworthy web generator should use.

2. Turning random numbers into characters without bias

A random 32 bit number has 4,294,967,296 possible values. To pick one of 87 characters, the obvious approach is to take the number modulo 87. But 4,294,967,296 is not a multiple of 87, so the first few characters get one extra chance each. The bias is small, yet it is a flaw in a tool whose only job is being unbiased.

The fix is rejection sampling: find the largest multiple of 87 below 2^32, and if the random number falls at or above it, discard it and draw again. Every character then has exactly the same probability. This site does this for every character, PIN digit and word.

3. Keeping the result private

A generator that sends passwords to a server, or loads advertising and analytics scripts that can read the page, defeats its own purpose. This site runs no third-party code. Its content security policy forbids scripts from anywhere but this site, and it allows only one outside connection: the optional, hashed breach check.

How to verify a generator yourself

  1. Open developer tools, select the Network tab, and generate a few passwords. There should be no requests.
  2. Disconnect from the internet and reload. A local generator keeps working.
  3. View the page source and search for getRandomValues. If you find Math.random used for passwords, leave.

Published 18 October 2026. Last reviewed 18 October 2026.

Sources

Related tools and guides