Skip to content
Jellykit

Secret Key Generator

Generate a random 256-bit secret key, or any size you need, for app secrets, HMAC signing and encryption, as Base64 or hex.

  • Runs on your device
Loading tool

About Secret Key Generator

Frameworks and services keep asking for a long random secret: a session or cookie secret, a JWT signing key, an HMAC key, an encryption key for an environment variable. This page starts with 32 random bytes, which is 256 bits, written as Base64, and also shows the same key in hex and Base64URL so it fits whatever format the setting expects.

Change the size if your system asks for a different length, such as 16 bytes for AES-128 or 64 bytes for HMAC-SHA-512. The key is created in your browser and is never sent anywhere or saved, so copy it straight into your secret store.

How it works

  1. The bytes are filled by crypto.getRandomValues, the browser’s cryptographically secure generator, in one call per 64 KB.
  2. Hex writes each byte as two digits. Base64 packs 3 bytes into 4 characters with = padding; Base64URL uses - and _ instead of + and / and drops the padding, so it is safe in URLs and file names.
  3. Several values at once are generated independently; each line of a download is one value in the encoding you chose.

Questions

Is 256 bits enough?

Yes. A 256-bit key from a secure generator cannot be guessed by brute force. It is the usual size for HMAC-SHA-256 and AES-256 keys and comfortably exceeds what JWT libraries require for HS256.

Which encoding should I paste into my config?

Use what the setting expects. Many frameworks just want a long random string, and Base64 works well. If a library decodes the value into key bytes, check whether it expects hex or Base64 so the key length comes out right.

Can I use this to make a password?

It is better suited to keys that machines read. For something a person types, the password or passphrase generators make values that are easier to handle.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.