UTILS.
Private by default
⊕

XOR Cipher

XOR-encrypt a message with a repeating key, producing hex output you can decrypt back.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →
— output appears here —

About this tool

A learning tool that encrypts text by XOR-ing it with a repeating key, and decrypts the result back. It runs in your browser and nothing is sent anywhere.

Type a message and a key, then press Encrypt. The message and the key are converted to UTF-8 bytes, each message byte is XOR-ed with the next key byte (the key repeats when it is shorter), and the result is shown as lowercase hex with no spaces. To decrypt, paste that hex into the message box, enter the same key and press Decrypt. Spaces and line breaks in the hex are ignored and upper or lower case is fine, but the digits must be valid and an even count, otherwise a hex error is shown.

Both directions need a key; with an empty key an error is shown. The output does not update as you type, so press the button each time. Non-English text works because the work is done on UTF-8 bytes, but a wrong key on decrypt usually gives garbled text with replacement characters rather than an error, since XOR can not tell whether a key is right.

Repeating-key XOR is trivially broken, especially with a short key, so use it only for demos, puzzles or light obfuscation, never for secrets.

Frequently asked questions

Why is the output in hexadecimal?
XOR can produce bytes that are not printable text. Hex keeps the ciphertext safe to copy, and Decrypt expects that same hex back.
Is XOR encryption secure?
No. A repeating key is easy to break, particularly a short one. It is meant for learning, CTF puzzles or light obfuscation, not for protecting sensitive data.
What happens if I use the wrong key to decrypt?
There is no error. You get garbled text, often with replacement characters, because XOR cannot tell a right key from a wrong one.
Can I paste hex with spaces?
Yes. Whitespace is removed before decoding, and either letter case works. The number of digits must be even and only 0-9 and a-f are allowed.

More tools