XOR Cipher (Text & File)

Security Client-side xor cipher encryption decryption encoder decoder obfuscation bitwise

This tool runs entirely client-side, in your browser: your data is never sent anywhere.

What it does

XOR each byte of your data against a repeating key. Every byte is reversible — XOR the result with the same key again to get the original back. Works with plain text, a file against a key, and two files against each other byte-by-byte. Everything runs client-side in your browser; nothing is ever sent to any server.

Try it

Widget 1 — Text

Enter any text, pick a key (as UTF-8 or hex bytes), choose an output format, then click Encode to get the XOR result. Use Decode to reverse it back to plain text.

Decode back to text

Widget 2 — File + Key

Upload any file, provide a key (UTF-8 or hex), and download the XOR'd result. Re-run with the same key on the output to recover the original.

Widget 3 — File vs File

Upload two files and XOR them against each other byte-by-byte. The output length equals the shorter file's size (a status note warns if the files differ in size). No key needed — the second file acts as the key. Useful for generating a third file that, when XOR'd with either original, recovers the other.

How it works

XOR (exclusive-or) is its own inverse. When you XOR a byte 0x5A with a key byte 0x3C you get 0x66. XOR 0x66 with the same key 0x3C again and you get back 0x5A. This makes XOR ciphers trivial to reverse, which is both their strength and their weakness — anyone who guesses the key recovers everything instantly.

Widget 1 — Text

Each character of the input text is XOR'd against the repeating key, interpreted byte-by-byte. The result is emitted in your chosen encoding:

The decode section reverses the process: it decodes the input format back to raw bytes, re-XORs with the key, and renders the result as UTF-8 text.

Widget 2 — File + Key

The entire file is read as an ArrayBuffer in the browser (via the FileReader API). Each byte is XOR'd against the repeating key (wrapping around when the key ends). The resulting bytes are packed into a Blob and offered as a download named <original-filename>.xor. Running the same operation again (XOR the .xor file with the same key) restores the original file.

> Tip: Strip the .xor suffix before re-running to keep the original filename.

Widget 3 — File vs File

No key needed — File B is the key. Both files are read as ArrayBuffers. Bytes are XOR'd together at each offset, up to the length of the shorter file (any trailing bytes in the longer file are ignored). The result is downloaded as xor-result.bin.

Because XOR is symmetric:

You can recover either original file by XORing the result with the other input file.

FeatureDetails
EncryptionXOR against a repeating key
ReversibilityXOR the result with the same key again
Text widgetUTF-8 or hex key, hex or Base64 output
File widgetAny file type, hex or UTF-8 key, Blob download
File vs File widgetTwo files XOR'd byte-by-byte, short file rules
Privacy100% client-side, no data leaves the browser