Crypto tools

XOR cipher

XOR cipher, classical cipher, a puzzle not a protection, computed on your device.

Runs on your device. The file is never uploaded.

XOR cipher combines every byte of your file with the repeating bytes of a text key, which defaults to key. The result is written to a new file with .xor added to the name. XOR is its own inverse, so any run of zero bytes copies your key straight into the output.

Input

Options

Questions

Is repeating-key XOR encryption?

It is a cipher, but not a secure one. A repeating text key falls to well-known methods: find the key length, then attack each position as a single-byte cipher, which is exactly what XOR brute force on this site does for the one-byte case. Use it for puzzles and CTF-style work. For real protection use AES-GCM encrypt.

How do I decrypt what I encrypted?

Run this same tool again on the output with the same key. XOR is its own inverse, so there is no separate decrypt tool. The output is named with .xor added, so notes.txt becomes notes.txt.xor, and running it again gives notes.txt.xor.xor holding the original contents. Rename it afterwards if the double suffix bothers you.

How is the key used?

The key is text, encoded to UTF-8 bytes and repeated over the length of the file: byte i of the input is XORed with key byte i modulo the key length. The default is the word key. An empty key is refused with "key must not be empty". There is no option to enter the key as hex.

Does it work on binary files?

Yes. The operation is over raw bytes, not text, and the result comes back as a file rather than as text on the page. Images and archives XOR correctly and come back byte for byte when you run the tool again with the same key.

Why can my ciphertext be read anyway?

Because XOR leaks structure. Runs of zero bytes reveal the key directly, repeated plaintext gives repeated ciphertext at multiples of the key length, and the key is usually a short dictionary word. A longer word fixes none of that. The only XOR that is secure is a one-time pad: a truly random key as long as the message, used exactly once.

Where does this run?

In a Web Worker in this tab, over bytes read from your device, and the result is offered back as a file download. Nothing is uploaded and nothing is stored between runs, including the key. That keeps the file away from everyone else while you work; it does not make the cipher any stronger than it is.

Related Crypto tools