Stream Cipher · 256-bit · RFC 8439

ChaCha20 Encryption & Decryption

Encrypt and decrypt data online using the ChaCha20 stream cipher — a fast, secure, constant-time algorithm trusted in TLS 1.3 and modern cryptography. 100% client-side, no data sent to any server.

256-bitKey Length
96-bitNonce Size
64 KBBlock Per Call
0Server Calls
0 characters
Please enter text to process.
Enter a 64-char hex key
Key must be exactly 64 hex characters (256-bit).
Nonce must be exactly 24 hex characters (96-bit).
Counter value (0 – 2³²−1). Use 0 for standard operation.
Select encoding of ciphertext when decrypting.
✅ Encrypted Output

Built for Speed & Security

ChaCha20 delivers exceptional security without sacrificing performance — even on devices without hardware AES acceleration.

🔑

256-bit Key Security

Full 256-bit key size offers 2²⁵⁶ possible keys — computationally infeasible to brute-force with any known technology.

Constant-Time Operations

All operations run in constant time, eliminating timing side-channel attacks that affect other ciphers including AES in software.

🛡️

RFC 8439 Compliant

Follows the IETF RFC 8439 standard, the same specification used in TLS 1.3, QUIC, WireGuard, and OpenSSH.

🔄

Stream Cipher Design

Generates a pseudorandom byte stream XORed with your data. Encrypt and decrypt use identical operations — symmetric by design.

📱

Mobile-First Performance

Originally designed for ARM processors, ChaCha20 outperforms AES-128-CTR on most mobile CPUs lacking AES-NI hardware instructions.

🔒

Client-Side Only

Your plaintext and keys never leave your browser. All encryption is performed in pure JavaScript using the Web Crypto API.

🎲

Cryptographic Random Gen

Generate cryptographically secure random 256-bit keys and 96-bit nonces using crypto.getRandomValues().

📤

Hex / Base64 Output

Export ciphertext as Hex, Base64, or Base64URL encoding — compatible with all downstream systems and APIs.

How ChaCha20 Encryption Works

ChaCha20 is a 20-round stream cipher. Here is the step-by-step process from key to ciphertext.

01

Enter Your Input

Type or paste the plaintext you want to encrypt. Switch to Decrypt mode to reverse a ciphertext.

02

Provide Key & Nonce

Supply a 256-bit (64 hex chars) key and a 96-bit (24 hex chars) nonce. Generate cryptographically random values instantly.

03

ChaCha20 State Init

A 4×4 matrix of 32-bit words is initialised using the ChaCha20 constant, key, counter, and nonce.

04

Quarter-Round Mixing

20 rounds of ARX (add-rotate-XOR) operations mix the state, producing an unpredictable 64-byte keystream block.

05

XOR with Plaintext

Each byte of plaintext is XORed with a corresponding keystream byte. The counter increments per 64-byte block.

06

Copy, Download, Use

The resulting ciphertext is shown in your chosen encoding. Copy it, download as a file, or swap into Decrypt mode.

Understanding ChaCha20 Encryption: Algorithm, Usage & Examples

ChaCha20 is a modern symmetric stream cipher designed by cryptographer Daniel J. Bernstein as a refinement of his earlier Salsa20 cipher. Standardised under IETF RFC 8439, ChaCha20 has become one of the most widely deployed encryption algorithms in the world, forming the backbone of TLS 1.3, QUIC, WireGuard VPN, and OpenSSH. Unlike block ciphers such as AES, ChaCha20 generates a continuous pseudorandom keystream that is XORed byte-by-byte with the plaintext, making it inherently parallelisable and extremely fast in software.

The ChaCha20 algorithm operates on a 512-bit (64-byte) state arranged as a 4×4 matrix of 32-bit unsigned integers. This state is initialised with four "expand 32-byte k" constant words, eight words from the 256-bit key, one 32-bit block counter, and three words from the 96-bit nonce. Twenty rounds of the quarter-round function — each performing add, rotate, and XOR (ARX) operations — thoroughly mix the state before the initial state is added back and the result is output as a keystream block. The counter ensures each block is unique, allowing the cipher to encrypt arbitrarily large messages without repeating keystream segments.

One of ChaCha20's biggest advantages is its resistance to timing attacks. Its operations rely only on 32-bit additions, bitwise XOR, and fixed-distance bit rotations — none of which depend on secret data in a way exploitable via cache timing. This gives ChaCha20 a major security edge over software implementations of AES in environments without dedicated AES-NI CPU instructions, such as most ARM-based mobile devices. For this reason, Google selected ChaCha20-Poly1305 as the preferred cipher suite for HTTPS connections on Android devices.

ChaCha20 decryption is identical to encryption: apply the same key and nonce, regenerate the keystream, and XOR with the ciphertext to recover the original plaintext. This symmetry simplifies implementation and halves the code complexity compared to block cipher modes that require separate encrypt and decrypt paths. It also means the nonce must never be reused with the same key — doing so would expose the XOR of two plaintexts, completely breaking confidentiality.

In practice, ChaCha20 is almost always paired with the Poly1305 MAC to form the ChaCha20-Poly1305 AEAD construction. This authenticated encryption mode adds an integrity tag that detects tampering before decryption occurs, protecting against chosen-ciphertext attacks. While the standalone ChaCha20 tool above provides confidentiality only, it illustrates the core encryption and decryption mechanics used inside every modern ChaCha20-Poly1305 implementation — from your browser's HTTPS stack to encrypted messaging applications like Signal.

Frequently Asked Questions

ChaCha20 is a high-speed symmetric stream cipher designed by Daniel J. Bernstein. It generates a pseudorandom keystream using a 256-bit key, 96-bit nonce, and a 32-bit counter, then XORs that stream with the plaintext to produce ciphertext. It is standardised in IETF RFC 8439 and widely used in TLS 1.3, WireGuard, QUIC, and OpenSSH.

ChaCha20 and AES-256 offer similar security margins when both are implemented correctly. However, ChaCha20 has a significant advantage in software-only environments: it is immune to cache-timing side-channel attacks that can affect software AES without hardware acceleration. On CPUs with AES-NI, AES is generally faster; on ARM devices without it, ChaCha20 is usually both faster and safer.

ChaCha20-Poly1305 combines the ChaCha20 stream cipher with the Poly1305 message authentication code to create an AEAD (Authenticated Encryption with Associated Data) cipher. The Poly1305 tag provides integrity verification, ensuring the ciphertext has not been tampered with before decryption. This construction is mandatory in TLS 1.3 and is used by Signal, WireGuard, and Google Chrome.

Nonce reuse is catastrophic in any stream cipher. If the same key–nonce pair is used to encrypt two different messages, an attacker can XOR the two ciphertexts together, cancelling the keystream and revealing the XOR of the two plaintexts. Always use a unique, random nonce for every message encrypted with the same key. The generator button on this tool uses crypto.getRandomValues() for safe random nonces.

Switch to Decrypt mode in this tool. Paste the ciphertext in hex or Base64, select the matching encoding under Advanced Options, enter the same 256-bit key and 96-bit nonce used during encryption, and click Decrypt. Since ChaCha20 uses the same keystream for both operations, the plaintext will be recovered instantly.

Yes. All encryption and decryption is performed entirely in your browser using pure JavaScript. No plaintext, keys, nonces, or ciphertext are ever sent to any server. You can verify this by turning off your internet connection after the page loads — the tool will continue to function normally.

Explore More Free Security Tools

SEOWebChecker.com offers 100+ free tools for cryptography, SEO, development, and AI. No sign-up required.

Copied to clipboard!