XOR Calculator Online — Compute XOR of Text, Binary & Hex
CodexFuse Team · 2026-10-13T18:37:57.832Z · 6 min read min read
Compute XOR of text, binary, and hex instantly with the free online XOR calculator, plus worked examples, the truth table, and encryption limits.
An XOR calculator compares two values bit by bit and returns a 1 wherever the bits differ and a 0 wherever they match. You type in two inputs, text, binary, or hex, and the tool lines up the bits and applies that one rule to every pair. If you need to check a bitmask, verify a checksum by hand, or decode a short XOR puzzle you created yourself, it gives you the answer in seconds without writing code.
XOR shows up in more places than most people expect. It powers parity checks, RAID storage, network checksums, feature flags, and puzzle solving. It is also one of the first operations developers meet when they start working with binary data, because it is simple, fast, and reversible. This guide explains what XOR does, how to compute it by hand, and how to use the free online XOR calculator for text, binary, and hex inputs. You will see where XOR is genuinely useful, and where it is too weak to protect real data.
What XOR Does, in Plain Terms
XOR stands for exclusive OR. It takes two bits and returns 1 only when exactly one of the two bits is 1. If both bits are the same, both 0 or both 1, the result is 0. A regular OR returns 1 when either or both inputs are 1. XOR excludes the both-1 case, so it behaves like a difference detector for bits.
| First bit | Second bit | XOR result | Plain meaning |
|---|---|---|---|
| 0 | 0 | 0 | Same, so 0 |
| 0 | 1 | 1 | Different, so 1 |
| 1 | 0 | 1 | Different, so 1 |
| 1 | 1 | 0 | Same, so 0 |
Why the truth table matters
Every XOR calculation comes down to those four cases. Longer inputs are simply the same table applied to each pair of bits. The property that makes XOR special is reversibility: XOR a value with a key, then XOR the result with the same key again, and you get the original value back.
XOR is one of six bitwise operations — the free bitwise calculator on this site covers AND, OR, NOT and both shifts as well, for when the job is not XOR alone. For single-bit gate logic rather than multi-bit arithmetic, a boolean algebra calculator evaluates all eight gates — AND, OR, XOR, NOT, NAND, NOR, XNOR and IMPLIES — on 0/1 inputs.
How Do You Compute XOR by Hand?
Write the two binary values one above the other, bits aligned, then apply the truth table to each vertical pair: output 1 when the two bits differ and 0 when they match. Work through every column, and the row of results is your answer. For example, 1010 XOR 1100 equals 0110, because the columns give 0, 1, 1, and 0.
A fictional worked example
The following example is fictional and is included only to show the steps. Suppose you want to compute 1010 XOR 1100 for a classroom exercise. Write 1010 above 1100, rightmost bits lined up. Compare each pair: 1 and 1 give 0, 0 and 1 give 1, 1 and 0 give 1, and 0 and 0 give 0. The full result is 0110.
How Do You XOR Text, Binary, and Hex?
Convert both inputs to binary first, then XOR the bits. Text becomes binary through character codes, and hex becomes binary by expanding each digit to four bits. Once both inputs are binary strings of the same length, apply the truth table column by column, then convert the result back to the format you need.
XOR of text
Each character in text has a numeric code, and that code can be written in binary. To XOR two short strings of the same length, convert each character to its code, XOR the matching codes bit by bit, and convert the results back to characters.
XOR of binary
Binary input is the simplest case because no conversion is needed. Align the two strings, pad the shorter one with leading zeros, and apply the truth table to each column. Use this case when you are checking a bitmask, a flags field, or a checksum by hand.
XOR of hex
Each hex digit stands for exactly four bits, so hex converts cleanly to binary. Expand each digit, XOR the binary strings, then group the result back into sets of four bits and convert each group to a hex digit. To verify that a file has not changed, use a file hash checker, which is designed for integrity checking in a way a hand-computed XOR is not.
Where XOR Helps, and Where It Does Not
XOR is genuinely useful in several everyday technical tasks. It toggles feature flags, compares bitmasks, builds parity bits for simple error detection, and combines values in puzzles and teaching exercises. In those settings, XOR does a narrow job, and other layers of the system carry the security burden.
- Checking whether two bit patterns differ, and exactly where they differ.
- Building parity and checksum logic for simple error detection.
XOR is not a safe way to protect real secrets on its own. A message masked with a short or repeating key can be unmasked by anyone who studies the pattern. For real data, use modern encryption such as AES-256 encryption over a secure channel such as TLS, and keep keys private. If you need a stream cipher for a legitimate engineering task, read about ChaCha20 encryption instead of building your own scheme from XOR.
Common mistakes to avoid
- Forgetting to pad the shorter input with leading zeros, which shifts every column.
- Treating XOR like OR and writing 1 where both inputs are 1.
- Assuming that an XOR-masked message is private, when the key is short, reused, or shared in plain sight.
How to Use the CodexFuse XOR Calculator
- Open the XOR calculator and select text, binary, or hex input.
- Enter your first value and your second value in the two input fields.
- Check that both values use the same format.
- Read the result, and use the copy option to paste it into your notes or code.
If you are checking a bitmask or working through an XOR puzzle, run the calculation in seconds.
Get Started with CodexFuseFrequently Asked Questions
What is an XOR calculator?
An XOR calculator compares two values bit by bit and returns 1 where the bits differ and 0 where they match. It accepts text, binary, and hex inputs.
What is the XOR of 1 and 1?
The XOR of 1 and 1 is 0, because the two bits are the same. XOR returns 1 only when exactly one input is 1.
Can XOR be used to encrypt private data?
No. XOR alone is not safe protection for private data, because a short, reused, or predictable key can be analysed and removed. Real secrets need modern encryption such as AES-256 over TLS.
Why does XORing twice return the original value?
XOR is its own inverse. XORing a value with a key masks it, and XORing the masked result with the same key unmasks it. This reversibility suits puzzles and checksums, not a sign of strength.
What should I check when an XOR result looks wrong?
Check alignment first. Confirm both inputs use the same format, the shorter binary string is padded with leading zeros, and you did not confuse XOR with OR.
Learn the four cases in the truth table, keep your bits aligned, and reserve real protection for modern encryption.















