Password Generator Guide: Create Strong, Secure Passwords
Password Generator Guide: Create Strong, Secure Passwords
Weak and reused passwords remain the single most common entry point in real-world
breaches. A password generator removes the human element entirely: instead of
predictable keyboard walks like Qwerty123!, it pulls every character from a
cryptographically secure random source. Try it instantly with our
Password Generator — it runs entirely in your browser, so
the generated password never travels over the network.
This guide explains how a password generator works under the hood, why character sets and length matter more than clever substitutions, how to reproduce the logic in JavaScript and Python, and the pitfalls that make "random-looking" passwords weak.
What Is a Password Generator?
A password generator assembles a string of a chosen length by repeatedly picking characters from a pool you control. Our tool exposes four toggles that build that pool:
| Character set | Characters | Pool size |
|---|---|---|
| Uppercase | A–Z | 26 |
| Lowercase | a–z | 26 |
| Numbers | 0–9 | 10 |
| Symbols | !@#$%^&*()_+-=[]{}|;:,.<>? | 26 |
With all four enabled, each position is drawn from 88 possible characters. The
critical detail is where the randomness comes from: the tool uses the Web
Crypto API (crypto.getRandomValues), not Math.random(). The former is seeded
by the operating system's entropy pool and is safe for secrets; the latter is a
predictable pseudo-random generator meant for animations and games.
Why Length Beats Complexity
Password strength is measured in bits of entropy: length × log2(pool size).
Every extra character multiplies the search space, while swapping a for @
barely moves it.
| Configuration | Entropy | Brute-force feasibility |
|---|---|---|
| 8 chars, lowercase only | ~37.6 bits | Cracked in minutes offline |
| 12 chars, letters + digits | ~71.5 bits | Weeks to years |
| 16 chars, all four sets | ~103.4 bits | Practically unbreakable |
| 24 chars, letters + digits | ~142.9 bits | Beyond any hardware |
A 16-character password from an 88-character pool has more entropy than a 20-character password built only from lowercase letters. When a site allows it, raise the length slider first — it is the cheapest security upgrade available.
Note the fourth row: dropping symbols but adding eight characters increases entropy. This is useful for legacy systems that reject special characters.
How to Generate Passwords in Code
The same logic the tool runs in your browser, in two languages. Both use
cryptographically secure sources — never Math.random() or Python's plain
random module for secrets.
JavaScript (Web Crypto API):
const CHARS =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +
"0123456789!@#$%^&*()_+-=[]{}|;:,.<>?";
function generatePassword(length = 16) {
const values = new Uint32Array(length);
crypto.getRandomValues(values);
let result = "";
for (let i = 0; i < length; i++) {
result += CHARS[values[i] % CHARS.length];
}
return result;
}
console.log(generatePassword(16)); // e.g. "4@FD{WtfcH$lQl<]"
Python (secrets module):
import secrets
import string
CHARS = string.ascii_letters + string.digits + "!@#$%^&*()_+-=[]{}|;:,.<>?"
def generate_password(length: int = 16) -> str:
return "".join(secrets.choice(CHARS) for _ in range(length))
print(generate_password(16)) # e.g. ";tuk5c-.Ljy>mjvO"
Python's secrets.choice performs rejection sampling internally, so it avoids
the slight modulo bias that naive % mapping introduces (more on that below).
Hands-on: Tested with the Tool
We tested the Password Generator with several configurations and verified every output. Steps to reproduce:
- Open the tool — it generates a password immediately on load with the default settings (length 16, all four character sets on).
- Default run (16, all sets): we clicked Generate three times and got
5-.}4@Y#)B6Vc+*l,;tuk5c-.Ljy>mjvO, and4@FD{WtfcH$lQl<]— each exactly 16 characters, mixing all four sets, and never repeating. - Length 24 with Symbols off: outputs like
1OM8cG2u8tDCWpXQYZOGmJTsand2y2Zm50Rcq1wi2TlqDBWEaUI— 24 alphanumeric characters, no symbols present, confirming the toggle strictly filters the pool. - Numbers only, length 12:
413869238077— digits exclusively, handy for PIN codes. - Edge case — all four toggles off: the tool falls back to lowercase + digits
rather than failing, producing e.g.
psri51l0ad(length 10). A sensible guard against an empty character pool.
Every observation matches the tool's documented behavior: output length always
equals the slider value, and disabled sets never leak into the result. We also
pasted the 16-character default output into our
Password Strength Checker, which rated it at
roughly 103 bits of entropy — consistent with the 16 × log2(88) math above.
Common Pitfalls
- Using
Math.random()for secrets. Its internal state can be recovered from a few outputs, making "random" passwords reproducible by an attacker. - Modulo bias. Mapping a 32-bit random value onto an 88-character pool with
%makes the first few characters of the pool very slightly more likely. For password generation the bias is negligible (< 0.000002%), but for cryptographic keys use rejection sampling. - Storing generated passwords in plain text. Generation is only half the job — servers must hash them; see our Bcrypt Generator for the standard approach.
- Mandatory composition rules. Forcing "at least one symbol" shrinks the search space slightly. Length requirements protect better than composition requirements.
- Reusing one strong password everywhere. One breached site then unlocks all of them. Generate a unique password per account.
Related Tools
- Password Strength Checker — measure entropy and estimated cracking time of any password.
- Bcrypt Generator — hash passwords for safe server-side storage.
- Hash Generator — compute MD5, SHA-1, SHA-256 and SHA-512 digests from text.
- OTP Generator — generate time-based one-time passwords for two-factor authentication.
- UUID Generator — random identifiers for records and API keys rather than logins.
When to Use This Tool Instead of Code
Write code when passwords must be created programmatically — user provisioning scripts, seeding test fixtures, or resetting credentials in bulk. For everything else, the tool wins:
- Zero setup. No runtime, no imports — open the page and copy the result.
- Privacy. Generation happens client-side; nothing is sent to a server.
- Correct randomness by default. The Web Crypto API is already wired in, so
there is no risk of accidentally shipping
Math.random(). - Instant experimentation. Toggle character sets and drag the length slider to match any site's password policy in seconds.
Generate one now with the Password Generator, check it
with the Password Strength Checker, and never type
Summer2026! again.