UtilityToolsLab

© 2026 UtilityToolsLab. Built and maintained by the UtilityToolsLab Team.

About·Changelog·Privacy Policy·Terms of Service·Contact
HomeSecuritySecret Key Generator

Related Tools

Password GeneratorPassword StrengthPassphrase GeneratorEntropy CalculatorAPI Key GeneratorPIN GeneratorPassword CheckerUUID v5CSRF Token Generator

Cryptographic Secret Key Generator

Generate 128–512-bit cryptographic secret keys in hex, Base64, Base64URL, or Base58 using crypto.getRandomValues. Batch up to 20 keys at once.

You Might Also Like

All Security

PIN Generator

Generate cryptographically secure PINs in numeric, alphanumeric, or hex mode. Choose length 4–16, batch up to 20 PINs, and group digits for readability.

Password Checker

Check a password against 10 structural weakness patterns — length, common words, keyboard walks, l33t-speak, year patterns and more. Runs locally.

PDF Unlocker

Remove the open password from a protected PDF and download the unlocked file. Decrypts entirely in your browser using pdf-lib — nothing is uploaded.

ECDSA Key Generator

Generate ECDSA or ECDH key pairs on P-256, P-384, or P-521 in PEM or JWK format using WebCrypto. Private key blurred by default. Nothing uploaded.

Every JWT secret, AES session key, HMAC signing key, and OAuth client secret starts the same way: a block of random bytes pulled from the operating system's cryptographic RNG. This tool exposes that primitive directly, with no server and no account, so you can generate production-quality keys in the format your stack expects without reaching for a terminal.

Pick a bit length (128, 192, 256, 384, or 512), choose an encoding, set the batch size (1 to 20), and every value is generated fresh by crypto.getRandomValues. Click Regenerate at any time to get a new set. Each key has its own Copy button, and Copy all appears when you generate a batch of two or more.

The page itself never contains a key. The HTML arrives with an empty list and your browser fills it after loading, so no two visitors, and no search-engine copy of the page, ever share a value. Your settings are remembered between visits; the keys never are, and a reload draws new ones. Type a batch size outside 1 to 20 and the box says “Enter 1 to 20” and keeps the last valid count until you fix it.

The Controls: Bit Length and Encoding

  • 128-bit — 16 bytes. The key size of AES-128, and plenty of entropy for a session token. It is too short for an HMAC-SHA-256 (JWT HS256) secret: RFC 7518 requires a key at least as long as the hash, so use 256 bits there.
  • 256-bit — 32 bytes. The standard choice for AES-256, JWT HS256 secrets, and general-purpose API keys. Recommended default.
  • 384 / 512-bit — 48/64 bytes. Required for HMAC-SHA-384 and HMAC-SHA-512 respectively, and used in high-assurance contexts where the key must outlive current computational assumptions.
  • Hex: lowercase hexadecimal, two characters per byte. Universally accepted in config files and environment variables. A 256-bit key produces 64 characters.
  • Base64: RFC 4648 standard encoding with +, /, and = padding. Used in HTTP headers, PEM files, and many backend frameworks.
  • Base64URL: URL-safe variant that replaces + with - and / with _, and drops padding. Required for JWT payloads, PKCE code verifiers, and any key that appears in a URL or cookie without percent-encoding.
  • Base58: excludes visually ambiguous characters (0, O, I, l). Standard in wallet addresses and token identifiers where humans may need to read or type the value.

Worked Example: A JWT HS256 Secret

An HS256 token is signed with HMAC-SHA-256, so its secret should be at least 256 bits. Choose 256-bit and Base64URL: each key is 43 characters, with no +, / or= to escape in an environment file. The same 32 random bytes come out as 64 characters in Hex, 44 in Base64 (one = of padding), and usually 43 or 44 in Base58, whose length varies with the value.

If you would rather generate it on the server, these give the same kind of key:

  • openssl rand -hex 32 prints 64 hex characters
  • python3 -c "import secrets; print(secrets.token_urlsafe(32))" prints 43 Base64URL characters
  • node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))" prints the same 43-character form

When Not to Use a Generated Key Directly

  • If your framework derives a key from a passphrase (bcrypt, Argon2, PBKDF2), pass the passphrase to the derivation function rather than a pre-generated key. The KDF provides the work factor that defends against brute force; bypassing it and using a raw key removes that protection.
  • Keys generated here are not SSH key pairs, TLS certificates, or RSA/ECDSA private keys. Those are asymmetric key pairs and require a different tool and format (PEM or DER).
  • Never commit a secret key to a source-control repository. Store it in an environment variable, a secrets manager, or an encrypted vault. Rotate any key immediately if it is ever exposed.

Key strength

256-bit is the standard for AES-256, JWT secrets, and session tokens. 512-bit suits HMAC-SHA-512.

Encoding

/ 20
Generated Key
256 bits of entropy — 32 bytes from crypto.getRandomValues

Generating in your browser…

Keys are generated entirely in your browser using crypto.getRandomValues — a CSPRNG. Nothing is sent to a server. Never share or commit secret keys; rotate them if they are ever exposed.