Tools / XOR Cipher
XOR Cipher Tool
Paste ciphertext as hex or raw text, enter the XOR key (text or hex), and see the decrypted output as both ASCII and hex. The key repeats cyclically. If you don't know the key, enable single-byte brute force to rank all 256 candidates by how printable the output is.
The key repeats cyclically if shorter than the ciphertext.
Paste ciphertext above, or load one of the examples below.
Try an example
How XOR encryption works
XOR (exclusive OR) is a bitwise operation that returns 1 only when its two input bits differ. Applying XOR twice with the same key restores the original value: (A ⊕ K) ⊕ K = A. This makes XOR both encryption and decryption with the same key.
In CTF challenges, XOR is often combined with a single repeating byte key or a short text key. If the plaintext starts with a known prefix like picoCTF{, you can recover part of the key directly by XOR-ing those known bytes against the ciphertext.
Challenges solved with this tool: picoCTF 2025 - Quantum Scrambler, picoCTF 2025 - ChaCha Slide.
The single-byte brute-force mode works because English text has a predictable character distribution. The tool XORs the ciphertext against all 256 possible byte values (0x00 through 0xFF) and scores each result by counting printable ASCII characters. The key that produces the most printable output is the top candidate. For challenges where the flag format is known (e.g., starts with picoCTF{), you can additionally verify the top candidate by checking whether the output contains those specific characters.
Multi-byte repeating XOR keys - often called a Vigenère XOR - are harder to brute-force directly, but the same divide-and-conquer strategy applies: first determine the key length (using Hamming distance or index of coincidence over the raw bytes), then crack each byte of the key independently as a single-byte XOR problem. This is the core technique behind breaking the classic Matasano / Cryptopals challenge set.
XOR is also widely used in file-format obfuscation and simple packing. Some CTF binaries store their flag in a data section XORed against a single constant byte to prevent it from appearing in a plain strings scan. Running the strings command and finding garbled output near the expected flag location is a strong hint that single-byte XOR obfuscation is in play. Paste the hex bytes here and run the brute-force mode to recover the key and the plaintext flag.
Use the ASCII Table to look up individual byte values when analyzing XOR output, or the Number Base Converter to convert between hex and decimal while working through the key recovery.
Challenges that use this tool
Challenges where it helps
- RicochetpicoCTF 2025 · Cryptography · Hard
- Tap into HashpicoCTF 2025 · Reverse Engineering · Medium
- Easy PeasypicoCTF 2021 · Cryptography · Medium
- Some Assembly Required 3picoCTF 2021 · Web Exploitation · Hard
- OTP ImplementationpicoCTF 2020 Mini-Competition · Reverse Engineering · Hard
- vault-door-6picoCTF 2019 · Reverse Engineering · Medium
- XtraORdinarypicoMini by redpwn · Cryptography · Hard
Guides that use this tool
- Patching Binaries, Cracking Crackmes, and Writing Keygens for CTFBeat a password-checking binary four ways: read the check, steal the answer from RAM, patch the branch, or write a keygen. Plus UPX unpacking and anti-debug bypass.
- XOR for CTF: Breaking XOR Encryption Without the KeyXOR encryption in CTF: single-byte brute force, repeating-key recovery with Hamming distance, known-plaintext key extraction, and spotting XOR loops in disassembly.
- Reversing Custom Ciphers for CTF: Breaking Homebrew EncryptionBreak homebrew CTF encryption with a three-probe chosen-plaintext test: classify the cipher as byte-independent, arithmetic, or stateful, then invert it.
- The picoCTF Cryptography Roadmap: From Caesar to Elliptic CurvesCryptography roadmap for CTF: a tiered path from encodings and classical ciphers through RSA, AES, Diffie-Hellman, and elliptic curves, with practice picks.
- Bash Scripting for CTF Automation: Loops, Pipes, and Brute-Force HarnessesBash scripting for CTF automation: brute-force loops, curl and nc fuzzers, grep/awk/sed filtering, xargs parallelism, and a reusable solve.sh you can copy.
- radare2 and rizin for CTF: A Beginner's WorkflowRadare2 and rizin for CTF: the command-line RE workflow, the letter grammar, aaa/afl/pdf, the decompiler, patching in write mode, and a worked crackme.
Tools that pair with this one
- ASCII TableInteractive ASCII reference with quick lookup by character, decimal, hex, or binary. Filter by printable, control, letters, digits, or symbols.
- Hex ViewerView text or raw hex bytes as a xxd-style hex dump with byte offset, hex columns, and ASCII sidebar. Highlights printable characters and null bytes.
- Number Base ConverterConvert numbers between binary, octal, decimal, and hexadecimal instantly. Enter any value and see all four bases update in real time.
- Recipe ChainStack decoders into a pipeline: Base64, hex, ROT, XOR, Morse, URL, Atbash, Vigenère, and more. Magic mode auto-discovers the chain. Bookmark the URL to save it.
Or browse all 40 CTF tools.