Generate a cryptographically random secret as Base64 (standard or URL-safe) or hexadecimal—useful for API keys, tokens, and config placeholders that expect encoded random bytes.
How it works
The tool draws byteLength random bytes with crypto.getRandomValues, then encodes them. Base64 mode uses standard alphabet (+, /, =) or URL-safe (-, _, no padding) when that switch is on. Hex mode prints each byte as two lowercase hex digits and ignores the URL-safe switch.
When to use it
- Creating sample API secrets or session tokens for local development
- Filling
.enventries that expect Base64 or hex random material - Comparing URL-safe vs standard Base64 encodings for the same byte length
Limitations
Output is random bytes only—this is not a password with memorable structure. URL-safe Base64 omits padding; some APIs still require = padding. Maximum length is capped for UI practicality.
Example
byteLength = 3, format Base64, URL-safe off might yield SGkh (encoding of three random bytes). Hex for bytes 0a ff yields 0aff.