Developer Password Generators

Copy-paste-ready code for generating cryptographically secure passwords in the language you're already using. Each example uses that language's secure randomness source — never a general-purpose or seeded PRNG.

Why the Randomness Source Matters

Every mainstream language ships two categories of random number generator: a fast, statistically-random one meant for simulations and games (random, Math.random(), java.util.Random), and a slower, cryptographically secure one meant for security-sensitive values (secrets, crypto.getRandomValues(), SecureRandom). Using the wrong one is one of the most common real-world password-generation bugs — the output looks random but can be predicted or reproduced by an attacker who knows (or guesses) the internal PRNG state or seed.

LanguageUse thisNever use this for passwords
Pythonsecretsrandom
JavaScriptcrypto.getRandomValues()Math.random()
Javajava.security.SecureRandomjava.util.Random
C#RandomNumberGeneratorSystem.Random
PowerShellRNGCryptoServiceProvider / RandomNumberGeneratorGet-Random (weaker PRNG)
MySQLGenerate outside the DB, or UUID() as an inputRAND()

Common Mistakes Across Languages

All Developer Guides

Also See