JWT secret generator 256 bit: ready when you open it
Most online generators ask you to pick a length, an alphabet and a format before they show you anything. This one does the opposite. A random secret of 32 bytes, which is 256 bits, is already on the screen when the page loads. Copy it and you are done. If you want it as a ready line for your .env file, one more button gives you JWT_SECRET= followed by the secret.
The bytes come from crypto.getRandomValues, the browser's cryptographically strong random number generator, not from Math.random and not from a phrase someone typed. The page then writes the same bytes as hex (64 characters), base64 (44 characters, ending in one = sign) or URL-safe base64 (43 characters, no padding).
Nothing goes to a server. The secret is made in your tab and is gone when you close it. To see that for yourself, open your browser's Network tab, press New secret a few times and watch the list stay empty.
JWT secret generator 32 characters: is that enough?
It depends on what the 32 characters are, because the standard speaks in bits, not characters. RFC 7518, section 3.2, says: “A key of the same size as the hash output (for instance, 256 bits for "HS256") or larger MUST be used with this algorithm.” For HS256 that means 256 bits, which is 32 bytes.
Now count what 32 characters can hold. Thirty-two hex characters are 16 bytes, or 128 bits, half of what HS256 asks for. Thirty-two URL-safe base64 characters are 24 bytes, or 192 bits. Getting to 32 bytes takes 64 hex characters or 43 URL-safe base64 characters. A 32-character secret reaches 256 bits only if every character is a full random byte, and encoded text never is.
Some libraries use the text of your secret as the key exactly as it is. In that case 32 ASCII characters are 32 bytes in size, so the rule is met on paper. But a string a person typed carries far less randomness than 32 random bytes. That is why the checker on this page shows two numbers, the size of the text and the size after decoding, so you do not have to count by hand.
JWT secret generator HS256, HS384 or HS512: how long should the key be?
The same RFC says HS384 and HS512 use “correspondingly larger minimum key sizes”: 384 bits for HMAC SHA-384 and 512 bits for HMAC SHA-512. In bytes that is 32 for HS256, 48 for HS384 and 64 for HS512. Tap the algorithm your app uses and the secret is made again at the right length.
Not sure which one you have? Look for HS256, HS384 or HS512 in your auth code, or paste a token into the JWT decoder and read the alg field in the header. If it says RS256 or ES256, your app signs with a key pair, not a shared secret, and this page is not what you need.
JWT secret generator base64, hex or URL-safe: which one?
They are the same random bytes written three ways. Hex uses only 0 to 9 and a to f, so it pastes safely into a .env file, a YAML file or a shell. Base64 is shorter but contains +, / and =, which some shells and config files treat as special. URL-safe base64 swaps those for - and _ and drops the padding.
The one thing a page cannot know is how your library reads the string. Check its documentation: if it says the secret is base64-encoded, choose Base64 or URL-safe. If it only says “secret”, any of the three works as a plain string.
JWT secret generator terminal commands: OpenSSL and Node
You do not have to use a website at all, and for a secret that protects real users that is a fair choice. OpenSSL makes the same kind of secret: openssl rand -hex 32 prints 64 hex characters and openssl rand -base64 32 prints the base64 form. OpenSSL's manual says the command generates random bytes with a cryptographically secure pseudo random number generator.
Open “Prefer your own terminal?” under the secret and you get the matching commands for the algorithm and format you picked, including a Node.js one-liner. Run them in any terminal that has OpenSSL or Node.js installed. Whichever route you take, keep the result in an environment variable or a secrets manager and never commit it to Git.
Check the secret you already use
Switch to Check my secret, paste your current secret and pick your algorithm. You get one plain verdict, Looks fine, Works but could be stronger or Replace this secret, followed by the reasons in ordinary words: too short for HS256, looks like hex so it is only 16 bytes once decoded, a placeholder such as “secret”, or text made only of letters.
A checker cannot see how a secret was made, so it only catches the obvious problems. A long phrase of lowercase words can pass a length test and still be easy to guess, which is why text made only of letters gets a warning. If you are unsure, press Make a strong one instead and swap it.
After you have the secret
Put it in an environment variable, not in the code. When staging and production drift apart, the .env diff checker compares two .env files in your browser without uploading them. To see whether a token was signed with the secret you just made, paste the token and the secret into the JWT decoder, which verifies HS256, HS384 and HS512 signatures locally.
Plan the switch before you change a live secret: tokens signed with the old one stop verifying, so people will need new tokens. More free developer tools are listed in every free tool and guide on Blogs Byte.
