Password generator
How Password generator chooses random characters
Password generator uses the browser?s cryptographic random source, discards bytes that would bias character selection, and rejects whole candidates missing a selected group. It stops with an error if randomness is unavailable or retry limits are reached. A successful result meets the selected policy; it is not a strength rating or a promise of acceptance by another site.
Start with one deliberate generation
The completed app creates one password when you choose Generate password. Set Password length and the character groups, inspect Effective alphabet, then generate. Success changes the indicator to Ready and enables Show password, Clear password and Download password .txt.
This guide follows the selection process behind that button. It explains why a result can contain uneven numbers of letters and digits, why repeated characters are permitted, and why a generation error leaves no result. The interface does not display the random bytes, rejected candidates or a retry counter.
Draw bytes from the browser?s cryptographic source
The implementation requests random bytes through crypto.getRandomValues, using a Uint8Array. Each byte is a number from 0 through 255. Those numbers are intermediate material: the generator still needs to map them to positions in the alphabet shown on screen.
If that browser function is unavailable, generation throws an error telling you to use a current browser over HTTPS or localhost. The implementation has no Math.random fallback. Treat that message as a failed generation; the app does not silently substitute a weaker source and produce a password anyway.
Discard bytes that would favor some characters
Consider an explanatory setup with only Lowercase selected and Exclude ambiguous characters unchecked. Its alphabet has 26 letters. Simply taking every byte modulo 26 would give the first 22 letters ten corresponding byte values each, but the last four only nine. The problem is that 256 does not divide evenly by 26.
The implemented filter accepts only bytes below 234, because 234 is nine complete groups of 26. It discards values 234 through 255. For an accepted byte, the remainder after division by 26 selects a letter: 0 selects a, 25 selects z, and 26 selects a again. Every letter has nine accepted byte values.
These numbers explain the code; they are not a recorded generation or benchmark. The cutoff is calculated from the effective alphabet size, so changing groups or ambiguity exclusion changes the mapping. Discarding a byte does not shorten the requested result: sampling continues until the candidate is complete or a limit is reached.
Reject missing groups without fixing positions
After building a full-length candidate, the generator checks that every selected group occurs. If one is missing, it discards the whole candidate and tries another. It does not reserve the first position for uppercase or insert a digit into a predetermined slot.
With Lowercase and Digits selected, for example, an all-letter candidate is rejected even though each individual letter was allowed. A candidate containing both groups can pass without equal group counts. Characters come from the combined alphabet, rather than giving each group an equal turn. Repeated characters are allowed; there is no duplicate-character rejection rule.
The two rejection steps serve different purposes: byte filtering removes an uneven mapping, while candidate rejection enforces group coverage. Neither provides a strength score, checks a breach database or verifies a destination?s acceptance rules.
Read a failure before transferring a result
The work is bounded: each candidate has at most 64 byte batches, and generation attempts at most 256 candidates. Exhaustion produces Random sampling limit reached or Policy sampling limit reached, followed by an instruction to try generating again. An invalid byte response also fails. These limits bound the work; they are not password-strength measurements.
Read the specific error first. Correct an invalid length or empty group selection. For unavailable randomness, follow the browser and hosting guidance. For a sampling-limit error, try Generate password again. Each attempt clears the previous result before starting, so a failed replacement does not leave an older password available for export.
After success, use Show password to select the result, or request the local text download. Your browser controls saving. The download is an unencrypted file containing the password plus a newline. There is no saved history, so finish transferring the result before another generation, a policy edit or leaving the page.
AI-assisted ForgeHub editorial. App capabilities were checked against its implementation; this guide is not an independent review.
Frequently asked questions
Does a repeated character mean generation failed?
No. The implementation permits repeats. It checks length and selected-group coverage, but does not require every character to be different.
Does every selected group get the same number of characters?
No. Characters are sampled from the combined effective alphabet, and each selected group must occur at least once. There is no equal-count allocation.
Can I keep the previous result if the next generation fails?
The app clears its current result before attempting another generation. Failure leaves no generated result and disables export. A copy or download you already transferred remains separate from the app.
Does Ready certify the password?s strength?
No. Ready indicates that generation succeeded with the selected policy. The app has no strength guarantee, breach lookup or destination-rule checker.