Here is a simple password generator working locally in your browser (no data is being saved to the server or else).
The source code is available below.
<!DOCTYPE html>
<html>
<body>
<font color=white>
<label>Password Length (4-64 characters):
<input type="number" id="length" value="12" min="4" max="64">
</label><br><br>
<label><input type="checkbox" id="uppercase"> Include Uppercase</label><br>
<label><input type="checkbox" id="numbers"> Include Numbers</label><br>
<label><input type="checkbox" id="special"> Include Special Characters</label><br><br>
<button onclick="generate()">Generate Password</button><br><br>
<input type="text" id="result" readonly style="width: 300px;"><br><br>
<script>
function generatePassword(length, options = {}) {
const lowercase = 'abcdefghijklmnopqrstuvwxyz';
const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const digits = '0123456789';
const special = '!@#$%^&*()-_=+[]{}|;:,.<>?/`~';
let charset = '';
if (options.includeLowercase !== false) charset += lowercase;
if (options.includeUppercase) charset += uppercase;
if (options.includeNumbers) charset += digits;
if (options.includeSpecialChars) charset += special;
if (charset.length === 0) {
return 'Select at least one character type!';
}
let password = '';
for (let i = 0; i < length; i++) {
password += charset[Math.floor(Math.random() * charset.length)];
}
return password;
}
function generate() {
const length = parseInt(document.getElementById('length').value);
const options = {
includeUppercase: document.getElementById('uppercase').checked,
includeNumbers: document.getElementById('numbers').checked,
includeSpecialChars: document.getElementById('special').checked,
};
const password = generatePassword(length, options);
document.getElementById('result').value = password;
}
</script>
</font>
</body>
</html>