TXT · Text & Data tools

XOR Calculator (Bitwise XOR Online)

Operand A
Operand B
expression

0x000000F0 XOR 0x0000000F = 0x000000FF

32-bit result

0000 0000 0000 0000 0000 0000 1111 1111

Unsigned decimal
255
Hexadecimal
0x000000FF
Octal
0o00000000377
Go to the full Bitwise Calculator

Shareable link

Settings are written to the URL as you change them. Nothing differs from the defaults yet.

Bitwise XOR calculator

Type a value into each operand field and the result updates as you type. Each field reads decimal, hexadecimal (0xFF), binary (0b10110010), and octal (0o377), and the two operands can use different bases. The result appears at once as unsigned decimal, hexadecimal, octal, and padded binary.

Example: 12 XOR 10

12 is 1100 in binary and 10 is 1010. XOR compares the two words bit by bit and keeps a 1 only where the bits differ, which gives 0110, or 6 in decimal. Enter 0b1100 and 0b1010 to check it.

Toggling bits

XOR flips a bit when the corresponding mask bit is 1 and leaves it unchanged when the mask bit is 0. That makes it the standard way to toggle a boolean flag without branching. XOR-ing a value with itself always produces zero, which is a common register-clearing trick in assembly.

Word size and signed output

Word size defaults to 32-bit and can be set to 8, 16, 64, or 128. Both operands are masked to that width before XOR runs, so a value that does not fit wraps. Signed output reads the same bits as a signed integer, which turns a 32-bit result of 4294967295 into -1. To apply a different operation to the same operands, use the full Bitwise Calculator.

Frequently Asked Questions

Type a value into each of the two operand fields. The result updates as you type. Each field accepts decimal, hexadecimal such as 0xFF, binary such as 0b10110010 and octal such as 0o377, and the two operands can use different bases.

Zero. XOR sets a bit only where the two inputs differ, so 0 XOR 0 and 1 XOR 1 are both 0, while 0 XOR 1 and 1 XOR 0 are 1. Any number XOR itself is 0, and any number XOR 0 is unchanged.

Both operands are masked to the selected word size, which defaults to 32-bit, so a value that does not fit wraps. A negative input is read as its two's complement pattern at that width, which is why -1 XOR 0 returns 4294967295 at 32-bit. Turn on Signed output to read the result as a signed integer instead.

Yes. Running a ^= b, then b ^= a, then a ^= b swaps the values in languages with in-place bitwise assignment. A temporary variable is clearer and no slower on modern compilers.

Because it is reversible. XOR the data with a key to get ciphertext, and XOR the ciphertext with the same key to get the data back. With a reused or short key it is trivially broken, which is why real ciphers only use XOR as one step.

Specific bitwise operations

Full Bitwise Calculator tool

Explore Our Tools

Browse all tools