Security

XOR Cipher

Encrypt and decrypt text with a repeating-key XOR cipher, with hexadecimal output. A classic building block of cryptography.

Last reviewed by the Radiatus Cloud team

Encrypt and decrypt text with a repeating-key XOR cipher.

Need this handled by experts?

Radiatus runs VAPT, managed SOC & security engineering for regulated teams.

Book a free security consult

Encrypt with a XOR cipher

The XOR cipher encrypts data by combining each byte of the message with a byte of a repeating key using the exclusive-or operation. It is a fundamental building block in cryptography because XOR is reversible: applying the same key again decrypts the data. This tool encodes text to a hexadecimal string using your key, and decodes a hex string back to text with the same key, since encryption and decryption are the identical operation.

The text is encoded as UTF-8 bytes first, so it handles any characters, and the output is shown in hex because XOR produces non-printable bytes.

Strengths and weaknesses

XOR is at the heart of serious cryptography, including the one-time pad, which is provably secure when the key is truly random and as long as the message and never reused. However, the simple repeating-key XOR shown here is weak: a short, reused key can be recovered through frequency analysis, so it must not be used to protect real secrets. It is excellent for learning how symmetric encryption works and for lightweight obfuscation.

For genuine security, use a modern cipher like AES with a proper key. This tool is for education and experimentation. All processing happens locally in your browser.

Related tools

  • Password Strength Checker — Measure password strength by entropy and pattern analysis rather than character-class rules. Checked entirely in your browser.
  • Password Generator — Generate strong random passwords and passphrases in your browser using the Web Crypto API. Nothing is transmitted, logged or stored.
  • Hash Generator — Generate MD5, SHA-1, SHA-256 and SHA-512 hashes in your browser. Compare checksums and verify file integrity with nothing uploaded to a server.
  • Base64 Encoder/Decoder — Encode and decode Base64 in your browser, including URL-safe Base64 and UTF-8 text. Handles files and data URIs locally with nothing uploaded.

Frequently Asked Questions

How does a XOR cipher work?

Each byte of the message is combined with a byte of the repeating key using exclusive-or. Applying the same key again reverses it, so encryption and decryption are identical.

Why is the output in hexadecimal?

XOR produces bytes that are often non-printable, so the result is shown as hex to display and copy it safely.

Is a repeating-key XOR secure?

No. A short, reused key can be cracked with frequency analysis. Only a truly random, non-reused key as long as the message is secure, as in a one-time pad.

What is XOR used for in real cryptography?

It is a core operation in stream ciphers and the one-time pad, and is combined with other steps in block ciphers like AES.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Enter text and a key; XOR to hex, or hex back to text.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.