Random Password Generator
Create secure passwords in seconds
How This Password Generator Works
1. Character Pools
The generator creates your password from four independent character sets:
- Uppercase A–Z (Unicode 65-90)
- Lowercase a–z (Unicode 97-122)
- Numbers 0–9
- Symbols – a curated list of common special characters:
! " # € % & / ( ) = ? [ ] { } $ £ @
2. Your Selections
Each checkbox lets you include or exclude a pool. All four options are enabled by default to maximise randomness and entropy, but you can tailor the mix to meet website rules.
3. Length Slider
Choose any length from 4 to 32 characters. Longer passwords are exponentially stronger; 12 + characters are recommended.
4. Generation Algorithm (JavaScript)
The core logic is implemented in js/pas.js
and follows these steps:
- Read your current slider value (
length
) and checkbox states. - Build an array of enabled generator functions:
const typesArr = [ { lowercase }, { uppercase }, { number }, { symbol } ] .filter(item => Object.values(item)[0]);
- For each required character position:
- Pick a random object from
typesArr
. - Call its matching helper (
getRandomLowerCase
,getRandomUpperCase
,getRandomNumber
,getRandomSymbol
). - Append the returned character to the result string.
- Pick a random object from
- Display the final password inside the result span.
All randomness is provided by Math.random()
, which gives sufficient entropy for everyday use. For ultra-high security (e.g. cryptographic keys) consider using window.crypto.getRandomValues()
.
5. Copy to Clipboard
Click “Copy” and the script briefly creates a hidden <textarea>
, executes document.execCommand('copy')
, then removes the element. A green “Copied!” badge confirms success.
6. Accessibility & Mobile Friendly Design
The layout uses responsive CSS Grid and Flexbox. Controls are large enough for touch devices, and all buttons have ARIA labels plus clear focus styles for keyboard navigation.