utilstuff.com
Back to Dev Tools

Random & Key Generator

Generate cryptographically secure random bytes, AES keys, HMAC secret keys, nonces, IVs, and derivation salts using browser CSPRNG locally.

🔐 Cryptographically Secure Randomness (CSPRNG):
Values are generated locally in browser memory using native crypto.getRandomValues(). Generated keys, nonces, and salts are never transmitted to any server.
Cryptographic Material Notice: Random bytes represent raw entropy for secret keys, IVs, nonces, and salts. They are not formatted user passwords or complete security protocols.

What Does the Random & Key Generator Produce?

This tool generates cryptographically random bytes using your browser's native CSPRNG (crypto.getRandomValues), suitable for use as keys, initialization vectors (IVs), nonces, or salts — then formats the output as hex, Base64, or Base64URL.

How to Use the Random & Key Generator

  1. Choose the purpose (key, IV, nonce, or salt) — this sets a sensible default length.
  2. Adjust the length in bytes if needed.
  3. Choose an output encoding: hex, Base64, or Base64URL.
  4. Generate and copy the result.

Technical Notes

  • Output comes from a cryptographically secure random source, not Math.random(), which is not safe for security-sensitive values.
  • The right length depends on purpose: AES-256 keys need 32 bytes, a GCM IV is typically 12 bytes — the tool's presets follow common conventions, but always match the requirement of the system you're generating for.

Frequently Asked Questions

Is this output safe to use as a real cryptographic key?+

Yes. Bytes come from the browser's CSPRNG (crypto.getRandomValues), the same source Web Crypto uses for keys, not from Math.random(). Generation happens in memory and nothing is transmitted.

How many bytes do I need?+

It depends on the purpose: an AES-256 key is 32 bytes, an AES-128 key 16, a GCM nonce is typically 12, and a salt is usually 16. The presets follow these conventions, but always match the exact requirement of the system you are generating for.

Does hex, Base64, or Base64URL change the strength of the value?+

No. Encoding only changes how the same random bytes are written down. A 32-byte value is 256 bits of entropy whether shown as 64 hex characters or about 43 Base64 characters — pick whichever format your target system expects.