XOR Calculator

Your details

The base used for both inputs. Results are always shown in all four bases.
Enter an integer in the selected base. Prefix 0b, 0x, or 0o is optional.
Enter an integer in the selected base.
The number of bits used for the operation. Results are masked to this width. 8-bit is suitable for most educational examples.
XOR result (decimal)
49

The bitwise XOR result as a base-10 integer

XOR result (binary)0011 0001
XOR result (hex)31
XOR result (octal)61
Set bits in result3
A (decimal)60
B (decimal)13
A60
B13
A XOR B49

A XOR B = 49 (binary: 0011 0001, hex: 31)

  • 3 out of 8 bits differ between A and B. Each differing bit position becomes a 1 in the result.
  • XOR is self-inverse: XORing any value with itself gives 0, and XORing with 0 leaves it unchanged. So (A XOR B) XOR B = A (49 XOR 13 XOR 13 = 60).
  • In one-time-pad encryption, a plaintext byte (60) XORed with a key byte (13) produces ciphertext (49). XORing the ciphertext with the same key recovers the original.

Next stepTo recover A from the XOR result, XOR it again with B: 49 XOR 13 = 60.

= Powered by OnlyCalculators