Secure random hex strings by digits or bytes, in bulk
Secret Key Generator
Get a properly random key for your app's config in the encoding it expects, ready to paste.
Loading tool…
How to use secret key generator
Tap a preset such as JWT HS256 secret, or set the number of bytes.
Choose hex, Base64 or Base64URL.
Copy the key, or see the same bytes in all three encodings.
Paste it into your environment file or secret store.
What this tool does
- Raw random bytes from crypto.getRandomValues, from 8 to 512 bytes.
- Shows the first key in hex, Base64 and Base64URL side by side.
- Presets for common uses: JWT HS256 and HS512, AES-256, session secrets and API tokens.
- Batches of up to 100 keys for seeding several environments.
How the result is verified
Each key is decoded back from the chosen encoding and compared byte for byte with the random bytes it came from.
Frequently asked questions
How long should a JWT HS256 secret be?
At least 32 bytes (256 bits), which is what the preset makes. Longer secrets do not make HS256 stronger, and shorter ones are refused by many libraries.
Hex or Base64?
Use what your software expects. Hex is two characters per byte and safe everywhere; Base64 is shorter; Base64URL is Base64 that is safe inside URLs and JWTs.
Is my data uploaded to a server?
No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.
Related tools
Bulk random strings from preset or custom character sets, no repeats
Build and sign HS256, HS384 and HS512 tokens from your own claims
MD5, SHA-1, SHA-256, SHA-384, SHA-512 and HMAC for text or files
Ed25519, ECDSA and RSA keys as PEM, JWK and OpenSSH, round-trip tested