๐Ÿ”€ XOR Cipher Calculator

Not suitable for real security use โ€” this is an educational/experimental tool.

Ciphertext (hex)230015070a554b321619091d4a

Enter text and a key to encrypt or decrypt it using a repeating-key XOR cipher. This is an educational/experimental simple cipher that relies on the property that XOR-ing twice with the same key restores the original value.

How to use

  1. Choose encrypt or decrypt mode.
  2. Enter plaintext (for encryption) or hex-encoded ciphertext (for decryption).
  3. Enter a key.
  4. The result is calculated automatically.

How the calculation works

The XOR cipher is one of the simplest ciphers: it combines the bytes of the text with the bytes of a key using exclusive OR (XOR), one byte at a time. If the key is shorter than the text, it is repeated. Encrypt: C[i] = P[i] XOR K[i mod key length] Decrypt: P[i] = C[i] XOR K[i mod key length] XORing twice with the same value gives back the original, so encryption and decryption are exactly the same operation. This tool converts the text and key to UTF-8 bytes, XORs them and shows the result in hex; to decrypt, enter the hex and it restores the text. A repeating-key XOR cipher is easily broken, for example by letter frequency analysis, so it must not be used to protect real secrets. Use it to learn how ciphers work.

Worked example

Text: Hello, World! Key: key First character: H (0x48) XOR k (0x6B) = 0x23 Second: e (0x65) XOR e (0x65) = 0x00 Third: l (0x6C) XOR y (0x79) = 0x15 Result: 230015070a554b321619091d4a Decrypting this hex with the same key "key" gives back Hello, World!

Things to be aware of

  • If the key is as long as the text, truly random and used only once, it becomes a one-time pad, which is theoretically unbreakable โ€” but sharing such a key securely is so hard that it is rarely used.
  • If part of the plaintext is known, XORing it with the ciphertext reveals the key directly.
  • To protect real data, use a standard cipher such as AES-GCM (try the text encryptor tool).

FAQ

Is XOR cipher secure?

No, itโ€™s not suitable for real security โ€” short keys are easily broken via frequency analysis. Use it only for education, experimentation, or simple obfuscation.

Why does XOR-ing twice with the same key restore the original?

XOR has the property A XOR B XOR B = A, so re-applying the same key used for encryption recovers the original data.

What if the result looks garbled?

If the decrypted bytes donโ€™t form valid UTF-8 text (e.g. because the key is wrong), no result is shown. Double-check that the key matches the one used for encryption.