Generate a cryptographically secure random password with configurable options.
Code
Utilitiesconst chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' + (includeSymbols ? '!@#$%^&*()_+-=[]{}' : '');
const randomValues = new Uint32Array(length);
crypto.getRandomValues(randomValues);
return Array.from(randomValues, v => chars[v % chars.length]).join('');Parameters
Password length.
Include special characters.
Browser·fetch() may be limited by CORS
More JavaScript Snippets
Constant Time Compare
Compare two strings in constant time to prevent timing attacks. Unlike === which returns early on first mismatch, this compares all characters regardless of where differences occur.
FNV-1a Hash
Fast non-cryptographic hash function.
Hash SHA-256
Generate a SHA-256 hash of a string. SHA-256 produces a fixed 64-character hexadecimal output regardless of input size.
Parse JWT Payload
Extract and decode the payload from a JWT token without verification. Useful for reading claims like user ID, expiration time, and roles from tokens.
Simple String Hash
Generate a simple numeric hash from a string.
XSS Attack Prevention
Escape HTML entities to prevent Cross-Site Scripting attacks.