DevToolCase
Sign in Sign in

Generate a secret key

Generate a random secret key for JWT, sessions or APIs: 16 to 64 bytes, in hexadecimal, Base64 or Base64URL.

Very strong · 256 bits of entropy

Runs entirely in your browser: nothing you type is sent or stored.

What is a secret key?

Applications need random secrets: the key that signs JSON Web Tokens or session cookies, an API key, a salt, an encryption key. It must be long and truly random; 32 bytes, 256 bits, is the usual choice.

Which format?

  • Hexadecimal: twice as many characters as bytes, only 0-9 and a-f, accepted everywhere.
  • Base64: shorter. Laravel's APP_KEY is 32 bytes in Base64, after base64:.
  • Base64URL: Base64 without +, / or =, safe in URLs, file names and environment variables.

Where the bytes come from

From your browser's cryptographic generator, as openssl rand -hex 32 does on the command line, and they are never sent. A production secret is still best created where it is used, on the server or in a secrets manager, rather than copied around.

Add this browser’s favorites to your account?

This browser has 0 favorites that your account does not have:

Either way, this browser keeps its favorites: you find them again after signing out.