Math calculators

XOR Calculator

Updated Dec 3, 2026 By Infinity Calculator Formulas Sources
Rate
Operand Inputs
Strips whitespace & invalid characters before processing.
Recomputes automatically on every change.

Settings
Hex Case
Settings or inputs have changed. Click Calculate to update results.
Result
Binary—
Octal—
Decimal—
Hexadecimal—
ASCII—
The result contains non-printable characters, shown as ·.
Characters: 0 | Bytes: 0
Step-by-Step Solution
Intermediate Calculation Steps
# Operand (input) Base Binary Running XOR (Binary) Running XOR (Hex)

Introduction

This XOR calculator lets you quickly compute the XOR (exclusive or) of two or more values. XOR is a basic math operation used in computer science, cryptography, and data processing. It compares bits one by one. If two bits are different, the result is 1; if they are the same, the result is 0.1

You can enter values in binary, octal, decimal, hexadecimal, or ASCII text. The calculator converts your inputs, XORs them together, and shows the result in every number format at once. It also gives you a clear, step-by-step solution so you can see exactly how the answer was found.

Use this tool to XOR hex strings, encrypt text with a simple key, check parity bits, or solve homework problems. Add as many operands as you need, load data from a file or URL, and copy or download your results with one click.

How to Use Our XOR Calculator

Enter two or more values into the operand fields, pick your settings, and this XOR calculator will show you the XOR result in binary, octal, decimal, hexadecimal, and ASCII, along with a full step-by-step solution.

Operand Inputs: Type or paste a value into each operand box. You start with two, but you can click Add Operand to XOR more values together. Click Remove to delete any extra operand you no longer need.

Input Base (Per Operand): Use each operand's dropdown to tell the calculator what format your value is in: Binary, Octal, Decimal, Hexadecimal, ASCII, or Auto Detect.

Delimiter: If you put more than one value inside a single operand box, pick the character that separates them: space, comma, semicolon, new line, or let Auto Detect figure it out.

Auto Cleanse Input: Check this box to clean your input before the calculation runs. For binary, octal, decimal and hexadecimal values, it removes any character that is not a digit of that base, such as a letter in a binary value. For ASCII text, it trims spaces and line breaks from the start and end of each value and removes hidden control characters other than tabs and line breaks. Spaces inside the text are kept.

Auto Calculate: Check this box to get results instantly every time you change an input or setting. When it is off, you must click the Calculate button yourself.

Load from File / Load from URL: Instead of typing, you can load operand data from a text file on your device or fetch it from a web URL.

Input Base (Global Override): Set this to force every operand to use the same base format at once, or leave it on "Use Per-Input Settings" to control each operand separately.

Output Format: Choose whether to display the XOR result in all formats at the same time or in just one: Binary, Octal, Decimal, Hexadecimal, or ASCII.

Bit Width / Padding: Pick Auto to use the width of the widest operand, or choose 8-bit, 16-bit, 32-bit, or 64-bit to pad shorter binary and hex results with leading zeros to that width. A result longer than the width you pick is shown in full.

Hex Byte Grouping: Choose how the hexadecimal output is spaced: no spaces, a space after every byte (two hex digits, as in FF 3A 00 B2), or a space after every 4-byte word (eight hex digits).

Hex Case: Pick whether hex letters appear as uppercase (FF3A) or lowercase (ff3a).

Show Intermediate Calculation Steps: Check this box to display a table that shows the running XOR result after each operand is applied.

Calculate: Click this button to run the XOR operation and see your results, the step-by-step solution, and the intermediate steps table.

Reset: Click this button to clear the operands and the results and start again with two empty operand boxes set to Auto Detect. Your settings go back to their starting values.

Copy Result / Download Result: After you calculate, click Copy Result to copy the output to your clipboard or Download Result to save it as a text file.

What Is XOR?

XOR stands for "exclusive or."2 It is a basic operation used in math and computer science. XOR compares two pieces of data bit by bit. A bit is the smallest unit of data and is either a 0 or a 1. The rule is simple: if two bits are the same, the result is 0. If two bits are different, the result is 1.1

Bit ABit BA XOR B
000
011
101
110

How XOR Works with Numbers

To XOR two numbers, you first convert them into binary (base 2). Then you line up their bits and compare each pair using the rule above.1 The result is a new binary number. You can then convert that result into other number systems like decimal, hexadecimal, or octal.

For example, take the decimal numbers 12 and 10. In binary, 12 is 1100 and 10 is 1010. XOR them bit by bit and you get 0110, which is 6 in decimal.

Where Is XOR Used?

XOR is used in many areas of computing. It plays a big role in encryption, where data is scrambled to keep it secret.1 It is also used in error checking and checksum generation, which helps detect mistakes when data is sent or stored. Storage systems like RAID use XOR to calculate parity data so files can be recovered if a drive fails. Subnet masking, by contrast, uses AND: a host ANDs a destination address with its subnet mask to see whether it is on the local subnet.4 Programmers also use XOR for data comparison and swapping values without needing extra memory.

Number Systems You Can Use

This calculator lets you enter values in several number systems:

  • Binary (Base 2) – Uses only 0 and 1.3
  • Octal (Base 8) – Uses digits 0 through 7.3
  • Decimal (Base 10) – The standard number system we use every day.
  • Hexadecimal (Base 16) – Uses digits 0–9 and letters A–F.1 Common in programming.
  • ASCII (Text) – Each character is turned into its byte value before the XOR is applied, spaces included.

XOR Properties

XOR has a few handy traits that make it useful:

  • Self-inverse: If you XOR a value with the same value, you always get 0.1 (A ⊕ A = 0)
  • Identity: Any value XORed with 0 stays the same. (A ⊕ 0 = A)
  • Order does not matter: You can swap the inputs and still get the same result.5 (A ⊕ B = B ⊕ A)
  • Grouping does not matter: When XORing three or more values, you can group them any way you like.5 ((A ⊕ B) ⊕ C = A ⊕ (B ⊕ C))

Because of the self-inverse property, XOR is reversible. If you XOR a message with a key, you can XOR the result with the same key to get the original message back.1 This is why XOR is at the heart of many encryption methods.


Formulas used

Multi-Operand Bitwise XOR 5
R = v_1 \oplus v_2 \oplus \cdots \oplus v_n
Successive (Running) XOR Step
R_k = R_{k-1} \oplus v_k, \quad R_1 = v_1
ASCII String to Integer Conversion
v = \sum_{i=0}^{n-1} b_i \cdot 256^{\,n-1-i}

Frequently asked questions

What does XOR mean?

XOR stands for exclusive or. It compares two bits at a time. If the bits are different, the result is 1. If they are the same, the result is 0.1 This rule is applied to every pair of bits in the values you enter.

How do I XOR hex values?

Type your hex values into the operand boxes. Set each operand's format to Hexadecimal, or prefix your value with 0x and use Auto Detect. Then click Calculate. The result appears in hex and all other formats.

Why is XOR useful in encryption?

XOR is reversible. If you XOR data with a key, you get encrypted data. XOR that encrypted data with the same key again, and you get the original data back.1 This makes XOR a building block in many encryption methods.

What happens if I XOR a number with itself?

You always get 0.1 This is called the self-inverse property. Every bit matches, so every XOR comparison produces 0.

What happens if I XOR a number with 0?

You get the same number back. Zero does not change any bit, so the original value stays the same.1 This is called the identity property.

Does the order of operands matter?

No. XOR is commutative, which means A ⊕ B gives the same result as B ⊕ A.5 You can also group operands in any order when XORing three or more values.5


Sources

  1. Advanced Encryption Standard (AES), FIPS 197 (updated 2023). National Institute of Standards and Technology. 2023;sections 3.1, 3.2, 4.1 and 5.3.4. Accessed September 28, 2026.
  2. Secure Hash Standard (SHS), FIPS PUB 180-4. National Institute of Standards and Technology. 2015;section 2.2.2, p. 5. Accessed September 28, 2026.
  3. Kirk D. Contemporary Mathematics, 4.3 Converting with Base Systems. OpenStax. 2023;section 4.3. Accessed September 28, 2026.
  4. Mogul J, Postel J. RFC 950: Internet Standard Subnetting Procedure. Internet Engineering Task Force. 1985;Section 2.2, p. 7. Accessed October 8, 2026.
  5. Rosulek M. The Joy of Cryptography, Appendix A: Math Review. MIT Press. 2026;Appendix A.1, Definition A.1.2. Accessed November 22, 2026.