Skip to content

Encrypt and decrypt

Encrypt and decrypt with AES-GCM, ChaCha20-Poly1305 and XChaCha20-Poly1305 in your browser. Tampering is detected.

32 bytes. AES-GCM also takes 16 or 24.

12 bytes. Never reuse a nonce with the same key.

Text that must match on decrypt, such as a header.

About this tool

AES-GCM and ChaCha20-Poly1305 are authenticated ciphers: besides encrypting, they produce a 16-byte tag, and decryption fails if the ciphertext, tag or associated data were changed. They are the ciphers TLS 1.3 uses.

Encrypt text with a 256-bit key and get the ciphertext and tag in hex, or paste them back to decrypt. XChaCha20-Poly1305 takes a 24-byte nonce, long enough to choose at random for every message.

Questions

What happens if I reuse a nonce?
With AES-GCM and ChaCha20-Poly1305, reusing a nonce with the same key can reveal the XOR of the two plaintexts and let an attacker forge messages. Use a fresh nonce for every message, or XChaCha20-Poly1305 with random nonces.
What is associated data?
Extra data, such as a header or a record ID, that is not encrypted but is covered by the tag. Decryption fails unless the same associated data is supplied.
Is my input sent to a server?
No. The page loads a compiled Dart engine into a Web Worker and does all the work in your browser tab. Nothing you type or drop in is uploaded, and the tools keep working offline once the page has loaded.

More tools