Skip to content
hateitall

Secret Key Generator

Get a properly random key for your app's config in the encoding it expects, ready to paste.

Processed locallyIn: Size in bytesOut: Hex, Base64, Base64URL

Loading tool…

How to use secret key generator

  1. Tap a preset such as JWT HS256 secret, or set the number of bytes.

  2. Choose hex, Base64 or Base64URL.

  3. Copy the key, or see the same bytes in all three encodings.

  4. Paste it into your environment file or secret store.

What this tool does

  • Raw random bytes from crypto.getRandomValues, from 8 to 512 bytes.
  • Shows the first key in hex, Base64 and Base64URL side by side.
  • Presets for common uses: JWT HS256 and HS512, AES-256, session secrets and API tokens.
  • Batches of up to 100 keys for seeding several environments.

How the result is verified

Each key is decoded back from the chosen encoding and compared byte for byte with the random bytes it came from.

Frequently asked questions

How long should a JWT HS256 secret be?

At least 32 bytes (256 bits), which is what the preset makes. Longer secrets do not make HS256 stronger, and shorter ones are refused by many libraries.

Hex or Base64?

Use what your software expects. Hex is two characters per byte and safe everywhere; Base64 is shorter; Base64URL is Base64 that is safe inside URLs and JWTs.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

Secure random hex strings by digits or bytes, in bulk

Length · Count→ HexLight on device

Bulk random strings from preset or custom character sets, no repeats

Length · Character set→ TextLight on device

Build and sign HS256, HS384 and HS512 tokens from your own claims

JSON claims · Secret→ JWTLight on device

MD5, SHA-1, SHA-256, SHA-384, SHA-512 and HMAC for text or files

Text · Any file→ HexModerate on device

Ed25519, ECDSA and RSA keys as PEM, JWK and OpenSSH, round-trip tested

Key type→ PEM (SPKI, PKCS#8, PKCS#1)Light on device