Skip to main content

ChaCha20 Key Generator

Generate a cryptographically random ChaCha20 encryption key — a fixed 256-bit key, optionally with a 96-bit nonce, output as hex or Base64. Generated entirely in your browser and never transmitted.

Input

ChaCha20 (RFC 8439, IETF variant) needs a unique 96-bit nonce alongside the key for each encryption.

Output

Keep this key secret — store it in a secrets manager, not in code or chat.

Use a fresh, unique nonce for every message encrypted with this key — never reuse a nonce.

Was this helpful?

Guides

What this tool does

It generates a cryptographically random ChaCha20 encryption key — always 256 bits, per RFC 8439 — and, optionally, a matching 96-bit nonce. Both are formatted as hex or Base64, ready to paste into a config file, environment variable, or crypto library call.

What is ChaCha20?

ChaCha20 is a symmetric stream cipher designed by Daniel J. Bernstein as a faster, simpler alternative to AES on hardware without dedicated AES acceleration (mobile CPUs, many embedded devices). It's usually paired with the Poly1305 message authenticator as ChaCha20-Poly1305, an AEAD (authenticated encryption) construction standardized in RFC 8439. It's a default or supported cipher suite in TLS 1.3, is used by the WireGuard VPN protocol, and is Google's preferred cipher for mobile TLS connections.

Unlike AES, which offers 128/192/256-bit key sizes, ChaCha20 has exactly one key size: 256 bits (32 bytes). There's no smaller-key variant to choose, so this tool has no key-size selector — the key it generates is always the right size.

Key vs. nonce

A ChaCha20 key alone isn't enough to encrypt anything — the cipher also needs a nonce ("number used once"): a value that must never repeat for a given key. The IETF variant standardized in RFC 8439 fixes the nonce at 96 bits (12 bytes) (paired with a 32-bit internal block counter, for a 128-bit internal state). Reusing a nonce with the same key breaks ChaCha20's security guarantees — an attacker who sees two messages encrypted with the same key/nonce pair can recover information about both plaintexts. Because of this, most real-world uses generate a fresh random nonce (or use a counter) for every message, and never persist a nonce for reuse.

This tool can generate a nonce alongside the key for convenience, but note that a single reused nonce output isn't meant to be used for more than one encryption — generate a new nonce per message in your actual application.

How to use it

  1. Choose an output format — hex (uppercase) or Base64, whichever your library or config format expects.
  2. Leave "Also generate a nonce" checked if you want a matching 96-bit nonce alongside the key, or uncheck it for a key-only output.
  3. Click Generate key.
  4. Copy the key (and nonce, if generated) with the copy buttons.

Click Generate again any time you need a fresh key or nonce — each click draws new random bytes from the browser's cryptographically secure random number generator, crypto.getRandomValues(), not Math.random(), which is fast but predictable and unsuitable for anything security-related.

FAQ

Why is there no key-size option, unlike AES? ChaCha20 is specified with a single 256-bit key size — there's no 128-bit or 192-bit variant to pick from, so a size selector would be a dropdown with one real choice.

Can I reuse the generated nonce for multiple messages? No — encrypting two different messages with the same key and nonce is a serious security failure for ChaCha20 (and any stream cipher). Generate (or derive) a fresh nonce for every encryption operation.

Which format should I use, hex or Base64? Either is a full-fidelity encoding of the same bytes. Hex is easier to read and debug; Base64 is roughly 25% shorter, which some config formats or environment-variable size limits prefer.

Is this key secure enough for production? Yes — the underlying randomness source is the same CSPRNG your operating system and browser use for TLS and other security-critical operations. The strength of your system still depends on keeping the key secret, generating a fresh nonce per message, and rotating the key appropriately.

Privacy

The key and nonce are generated entirely in your browser using the Web Crypto API. They are never sent to our servers, logged, or stored anywhere — closing or reloading the page discards them permanently, so save them somewhere secure before you navigate away.

chacha20keynonceencryptioncryptocipherrandomgenerator

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.