Math calculators

XOR Calculator

Updated Jul 8, 2026 By Jehan Wadia
Rate Formulas
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.

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 the dropdown next to each operand 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 automatically strip out spaces and invalid characters from your input before the calculation runs.

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 fewest bits needed, or choose 8-bit, 16-bit, 32-bit, or 64-bit to pad the binary and hex output to a fixed width.

Hex Byte Grouping: Choose how the hexadecimal output is spaced — no spaces, grouped in byte pairs, or grouped in 4-byte words.

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.

Example: Click this button to load a sample pair of values so you can see how the calculator works.

Clear All: Click this button to erase all inputs and results and start over.

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." 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.

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. 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. 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. In networking, XOR operations appear in tasks such as subnet masking and IP address calculations. 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.
  • Octal (Base 8) – Uses digits 0 through 7. This is the same base used by tools like the chmod calculator for file permissions.
  • Decimal (Base 10) – The standard number system we use every day.
  • Hexadecimal (Base 16) – Uses digits 0–9 and letters A–F. Common in programming.
  • ASCII (Text) – Each character is turned into its byte value before the XOR is applied.

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. (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. (A ⊕ B = B ⊕ A)
  • Grouping does not matter: When XORing three or more values, you can group them any way you like. ((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. This is why XOR is at the heart of many encryption methods. For other bitwise and number-base operations, you can also try our modulo calculator or work with very large values using the big number calculator.


Formulas used

Multi-Operand Bitwise XOR
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. This rule is applied to every pair of bits in the values you enter.

Can I XOR more than two values at once?

Yes. Click the Add Operand button to add more input fields. The calculator XORs all values together from top to bottom. You can add as many operands as you need.

What number formats does this XOR calculator support?

You can enter values in binary (base 2), octal (base 8), decimal (base 10), hexadecimal (base 16), or ASCII text. Use the dropdown next to each operand to pick the right format, or set it to Auto Detect.

How does Auto Detect know which base my input is in?

Auto Detect looks at the characters in your input. If it starts with 0x, it is treated as hex. If it starts with 0b, it is binary. If it starts with 0o, it is octal. If it only has digits 0–9, it is decimal. If it has letters A–F mixed with digits, it is hex. Anything else is treated as ASCII text.

Can I XOR two text strings together?

Yes. Set the input format to ASCII for each operand. The calculator converts every character to its byte value, XORs the bytes, and shows the result. If the two strings are different lengths, the shorter one is treated as having fewer bytes.

Why does my ASCII result show dots (·)?

The dot symbol · stands for a non-printable character. When the XOR result produces a byte that has no visible character (like a control code), the calculator shows a dot in its place so you can still see the output.

What does the Auto Cleanse option do?

When Auto Cleanse is checked, the calculator removes extra spaces and invalid characters from your input before running the XOR. This helps if you paste data that has formatting you do not need.

What is the bit width setting for?

The Bit Width setting controls how many bits the output is padded to. Set it to Auto to use the fewest bits needed, or pick 8-bit, 16-bit, 32-bit, or 64-bit to pad the binary and hex output with leading zeros to a fixed length.

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.

Can I put multiple values in one operand box?

Yes. Use the Delimiter setting to tell the calculator how your values are separated — by spaces, commas, semicolons, or new lines. Each separated value will be XORed as its own operand.

Is this calculator free to use?

Yes. This XOR calculator is completely free with no limits on how many times you use it. There is no sign-up or account needed.

Does this tool store my data?

No. All calculations run in your browser. Your input data is not sent to any server or stored anywhere. Once you close or refresh the page, your data is gone.

How do I copy or save my result?

Click Copy Result to copy the output to your clipboard. Click Download Result to save it as a .txt file on your device.

What does the step-by-step solution show?

The step-by-step section shows how each operand is converted to a number, then walks through each XOR operation one at a time. It shows the running result after each step so you can follow the full calculation.

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. This makes XOR a building block in many encryption methods.

What happens if I XOR a number with itself?

You always get 0. 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. 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. You can also group operands in any order when XORing three or more values.

Can I load data from a file instead of typing it?

Yes. Click the Choose File button to upload a text file from your device. The file's content will be placed into the first operand box. The maximum file size is 5 MB.

What is hex byte grouping?

Hex byte grouping adds spaces to the hexadecimal output to make it easier to read. Pairs groups every two hex digits (one byte), like FF 3A 00. 4-byte words groups every eight hex digits. None shows the hex string with no spaces.

Can I use this XOR calculator on my phone?

Yes. The calculator is responsive and works on phones, tablets, and desktops. All features work the same on any screen size.

How large can the input numbers be?

This calculator uses BigInt internally, so it can handle very large numbers with no fixed upper limit. You can XOR values hundreds of digits long without losing precision.