RH
Tool

JWT Secret Generator

Generate secure secret keys for signing JWT tokens

Client-side processing
JWT Secret generado
8333238a2294fb359353eb5153e25618debf7aff8cdc2ff1699aecb928cc42fd3cba17ec64d21c84702d088dfb378d3ae27214bed0a5bfbea9994407a8ee4f5e
128 caracteres512 bits de entropía
32 bytes (256 bits)128 bytes (1024 bits)

Ejemplo de uso en .env

JWT_SECRET=8333238a2294fb359353eb5153e25618debf7aff8cdc2ff1699aecb928cc42fd3cba17ec64d21c84702d088dfb378d3ae27214bed0a5bfbea9994407a8ee4f5e

Generación segura

Este secret se genera usando la API Web Crypto del navegador con crypto.getRandomValues(), garantizando aleatoriedad criptográficamente segura. El secret nunca sale de tu navegador.

Info

Online JWT Secret Generator - Secure Keys for JSON Web Tokens

What is a JWT secret and why does it have to be strong?

The JWT secret, also called the signing key, is the cryptographic key used to sign and verify JSON Web Tokens with symmetric algorithms such as HS256, HS384 and HS512. It is the heart of your authentication security: if an attacker obtains it, they can mint valid tokens for any user, administrators included. A weak or predictable secret such as "secret", "password123" or a value copied from a tutorial is one of the most common and most critical vulnerabilities in JWT implementations. This tool produces secrets with cryptographically secure entropy through the browser Web Crypto API.

How many bits of entropy does a JWT secret need?

The security of a JWT secret comes from its entropy. For HS256 the recommended minimum is 256 bits (32 bytes), matching the HMAC-SHA256 key size. For HS384 use 384 bits (48 bytes) and for HS512 use 512 bits (64 bytes). In practice, secrets of 256 to 512 bits are more than sufficient for any application. This tool can generate up to 1024 bits for a larger future margin. A 256-bit secret has 2^256 possible values, a number so large that guessing it by brute force is computationally impossible even with all the computing power on the planet.

Best practices for managing JWT secrets in production

Never hardcode the JWT secret in your source code or commit it to a repository. Store it in environment variables or a secrets manager such as AWS Secrets Manager, HashiCorp Vault or Azure Key Vault. Use a different secret for every environment: development, staging and production. Rotate secrets periodically while keeping the previous one accepted for a short window so tokens in flight stay valid. In microservice architectures, consider asymmetric algorithms such as RS256 or ES256, where only the authentication service holds the private key and everyone else verifies with the public one. Never expose the secret in logs, error messages or API responses.

If you work with this tool, you will probably also find these useful JWT Decoder, Password Generator, UUID Generator, AES Encryption.

Frequently asked questions

Can I use any string as a JWT secret?

Technically yes, but predictable strings are extremely dangerous. Phrases such as "my-secret-key", "jwt-secret" or any dictionary word fall quickly to dictionary and brute-force attacks, and tools like jwt_tool can try millions of common secrets in seconds. Always use a randomly generated secret with enough entropy. This tool emits cryptographically secure random bytes that cannot be guessed.

Should I use the hexadecimal or the Base64 format?

Both are valid and secure. Hexadecimal uses 0-9 and a-f, producing a longer but universally compatible string. Base64 is more compact, using A-Z, a-z, 0-9, + and /, though those last characters can be awkward in some contexts. For environment variables and .env files both work fine, and most JWT libraries accept either. Pick the one you prefer or the one your framework expects.

What happens if I change the JWT secret in production?

Every token signed with the previous secret is invalidated immediately and users have to authenticate again. For rotation without downtime, support multiple secrets: first add the new secret as a secondary verification key, then promote it to the signing key, and finally drop the old one once all tokens signed with it have expired. Many JWT libraries accept an array of secrets for exactly this purpose.

Is it safe to generate secrets in the browser?

Yes. This tool uses crypto.getRandomValues() from the Web Crypto API, which returns cryptographically secure random numbers sourced from the operating system random number generator. The generated secrets never leave your browser and are not transmitted to any server, so it is as safe as generating them locally with OpenSSL or any command line tool.

© 2026
Roberto Hernando
|