Password Generator

Copied!

Generate strong, random passwords locally in your browser.

16

Code Examples

How to generate secure random strings in various languages.

Snippet Copied!
// Generate cryptographically secure random string (Node.js 19+ or Browsers)
function generateRandomString(length) {
    const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    let result = "";
    const randomValues = new Uint32Array(length);
    crypto.getRandomValues(randomValues);
    
    for (let i = 0; i < length; i++) {
        result += chars[randomValues[i] % chars.length];
    }
    return result;
}

console.log(generateRandomString(16));