Secret Key Generator
Make random secrets for JWT signing, session cookies, encryption keys, webhooks and API tokens. Choose the format and length, add a prefix if your keys use one, and generate up to 20 at once with the cryptographic random generator of your browser.
How to use this tool
- Choose a format: hex, Base64, Base64URL, letters and digits, or a password with symbols.
- Set the length. For hex and Base64 it is the number of random bytes; 32 bytes (256 bits) suits most secrets.
- Optionally add a prefix such as sk_live_ and choose how many secrets you want.
- Copy one secret or all of them. Changing an option, or "Generate new", makes fresh ones.
What this tool can do
Hex, Base64 and Base64URL
Raw random bytes in the encodings frameworks expect: hex for many config files, Base64 for keys, Base64URL for values that go into URLs and headers.
API keys and passwords
Letters and digits for API keys and tokens, or passwords with symbols. Quotes, backslashes and spaces are left out so the result is safe in .env files and shells.
Unbiased randomness
Bytes come from crypto.getRandomValues, and characters are picked with rejection sampling, so every character is equally likely.
Entropy shown
The bits of randomness are shown for the chosen length and format, with a warning under 128 bits.
Tips and common problems
How long should a JWT secret be?
For HS256 use at least 32 random bytes (256 bits), as RFC 7518 asks a key at least as long as the hash. HS512 deserves 64 bytes.
Laravel APP_KEY or similar framework keys
Laravel expects base64: followed by 32 random bytes in Base64. Choose Base64, 32 bytes, and add the base64: prefix.
The secret breaks my .env file
Use hex, Base64URL or letters and digits, which never contain quotes, spaces or #. Wrap Base64 values in quotes if they contain +, / or =.
Frequently asked questions
Are these secrets really random?
Yes. They come from crypto.getRandomValues, the cryptographically secure generator built into the browser and fed by the operating system.
Is a generated secret stored or sent anywhere?
No. It exists only in your browser tab until you copy it and close the page.
What is the difference between Base64 and Base64URL?
Base64URL replaces + and / with - and _ and drops the = padding, so the value can go into URLs, file names and HTTP headers without escaping.
How many bits of entropy do I need?
128 bits is the usual minimum for secrets that protect anything real; 256 bits (32 random bytes) is a comfortable default for keys and tokens.
More developer tools
Password Generator
Strong random passwords with the length and character types you choose.
Open tool →Key Pair Generator
RSA, ECDSA and Ed25519 key pairs as PEM, PKCS#1, OpenSSH and JWK, with the SSH fingerprint.
Open tool →UUID Generator
UUID v4 and v7 in bulk, with options, plus a validator that reads version and time.
Open tool →