XOR Cipher Tool
Encrypt or decrypt text with XOR using a text or hex key. Shows hex and base64 output, warns when the key is shorter than the plaintext.
Enter an even-length hex string, e.g. 2f4a9c
Key shorter than input — the key repeats.
A repeating key leaks ciphertext patterns that statistical analysis can break.
Use a key at least as long as the input for real security.
Invalid hex key — must be an even-length string of hex digits (0–9, a–f).
Output (text)
Hex
—
Base64
—
Summary
0
Input bytes
0
Key bytes
1
Key cycles
Sample inputs — click to load
Copied!
Summary
Encrypt or decrypt text with XOR using a text or hex key. Shows hex and base64 output, warns when the key is shorter than the plaintext.
How it works
- Enter plaintext (or ciphertext to decrypt) in the input field.
- Type a key in text or hex format and select the matching mode.
- The tool XORs each input byte with the corresponding key byte, cycling the key.
- Hex and base64 representations of the result appear instantly.
- A warning highlights key reuse when the key is shorter than the input.
Use cases
- Demonstrate XOR encryption in a cryptography or security course.
- Quickly obfuscate short strings for non-sensitive local storage.
- Test CTF (capture-the-flag) challenges that use XOR with a repeating key.
- Illustrate why short, repeated keys are vulnerable to known-plaintext attacks.
Frequently Asked Questions
Last updated: 2026-07-01 ·
Reviewed by Nham Vu