TXT · Text & Data tools

Bitwise XOR Calculator

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, with no button to press. 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.

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.

XOR (Exclusive OR) returns 1 only if the bits differ. It is widely used in cryptography, checksums, and toggling states because applying the same XOR operation twice restores the original value.

Yes. Executing `a ^= b; b ^= a; a ^= b;` swaps the values in languages that support in-place bitwise mutation, though it is usually less readable than using a temporary variable.

Because XOR is reversible. If you XOR your data with a key, you get ciphertext. XOR the ciphertext with the exact same key and you get your original data back.

Specific bitwise operations

Full Bitwise Calculator tool

Explore Our Tools

Browse all tools