Skip to content
XUtilHub

Secret Key Generator – Random API Keys & Secrets

Generate cryptographically secure random keys for APIs, JWT secrets, session secrets and encryption, in hex, Base64 or Base64URL.

  • Free, no sign-up
  • Runs in your browser, nothing uploaded

About the Secret Key Generator

Create strong random secrets for applications: API keys, JWT and session signing secrets, and encryption keys, at 128, 256 or 512 bits, in the format you need.

Key features

  • 128, 256 or 512-bit keys
  • Hex, Base64, Base64URL or alphanumeric
  • Cryptographically secure randomness
  • Five keys at a time
  • One-click copy
  • Never sent anywhere

Generate secure keys for your apps

Applications need random secrets for signing tokens, encrypting data and securing sessions. Choose the strength and format, then copy a key.

Common uses

UseRecommended
JWT secret (HS256)256 bits
Session or cookie secret256 bits
AES-256 key256 bits (hex: 64 characters)
API key128–256 bits, Base64URL
NextAuth / Auth.js AUTH_SECRET256 bits, Base64

Key lengths by format

StrengthHexBase64Base64URL
128 bits32 chars24 chars22 chars
256 bits64 chars44 chars43 chars
512 bits128 chars88 chars86 chars

UUID generator, password generator, and bcrypt generator.

How to use the Secret Key Generator

  1. Enter your text, password or settings in the tool above.
  2. Results appear instantly and are calculated in your browser.
  3. Read the explanation and warnings under the result.
  4. Copy what you need. Nothing is uploaded or stored.

Frequently asked questions

How long should a secret key be?

256 bits (32 bytes) is the standard choice for JWT signing secrets (HS256), session secrets and AES-256 keys. 128 bits is the minimum for most uses.

Which format should I use?

Hex is the most compatible. Base64 is shorter. Base64URL is safe in URLs and environment variables. Use letters and numbers only for systems that reject symbols.

Is Math.random good enough for keys?

No. Math.random isn't designed to be unpredictable. This tool uses crypto.getRandomValues, the browser's cryptographically secure generator.

Where should I store keys?

In environment variables or a secrets manager, never in source code or version control. Use different keys for development and production, and rotate them if they might have leaked.

Are my passwords and files sent to your servers?

No. All checks, hashing and encryption run in your browser using its built-in Web Crypto features. The only network request is the optional breach check, which sends just the first 5 characters of your password's SHA-1 hash, never the password.

Can I trust browser-based security tools?

These tools use the same standard algorithms (AES-GCM, PBKDF2, SHA-2, HMAC) built into your browser. Still, never type the passwords or 2FA secrets of important accounts into any website you don't control.

Do the tools work offline?

Yes. Once a page has loaded, everything except the breach check works without a connection.

Last updated:

Related Security tools