XOR Calculator — Bitwise Exclusive OR with Binary View
Compute the bitwise XOR (exclusive OR) of two integers in 4, 8, 16 or 32-bit mode. See the result in decimal, binary and hex, with a step-by-step bit-column view showing exactly which bits differ — the core operation behind bit-toggling, checksums and XOR encryption.
Bit width
A
B
XOR rule: same bits → 0, different → 1
A XOR B
Kif jaħdem dan il-kalkulatur?
XOR compares bits pairwise: output is 1 when bits differ, 0 when equal. For example 42 ^ 27 = 49 (00101010 XOR 00011011 = 00110001 in 8-bit). Key properties: A^A=0, A^0=A, and (A^B)^B=A (self-inverting). Used for bit toggling, parity, checksums, and XOR encryption.
Formula
How this is calculated
XOR (exclusive OR) compares each corresponding pair of bits independently: the output bit is 1 if and only if the two input bits differ. When the bits are the same (both 0 or both 1), the output is 0. This makes XOR a self-inverting operation — applying XOR twice with the same key restores the original value: (A ^ B) ^ B = A.
This calculator masks each operand to the chosen bit width (4, 8, 16 or 32 bits) before operating, mirroring the behaviour of fixed-width unsigned integers in C, Rust, Go and most systems languages. Values outside the register range are silently wrapped by the mask. The bit-column step view aligns A, B and the XOR result so you can verify each output bit against the rule directly.
XOR has many practical uses: toggling individual bits in a bitmask (bit ^= (1 << n)), fast in-place integer swapping (a ^= b; b ^= a; a ^= b), computing single-bit parity for error detection, and symmetric key encryption (the one-time pad is XOR with a random key). It is also used extensively in checksums, hash-function mixing, CRC computation and RAID-5 error correction.
Mistoqsijiet frekwenti
XOR is used for bit toggling (flip a specific bit without affecting others), in-place variable swapping (a ^= b; b ^= a; a ^= b), parity computation (XOR all bytes gives 0 for even-parity), simple encryption and masking, and hash mixing. Key identities: A ^ A = 0 and A ^ 0 = A.
XOR encryption applies the key byte-by-byte: ciphertext = plaintext ^ key. Decryption is identical: plaintext = ciphertext ^ key. If the key is as long as the message and truly random (one-time pad), the cipher is information-theoretically unbreakable. Short or repeated keys are weaker and vulnerable to frequency analysis.
XOR (^) outputs 1 when bits differ. XNOR (equivalence) outputs 1 when bits are the same — it is the bitwise NOT of XOR. XNOR is used in equality comparisons and error-correcting circuits. Most languages lack a dedicated XNOR operator; compute it as ~(A ^ B) masked to the required bit width.
Magħruf ukoll bħala
TG we-Calculate Editorial Team. (2026). XOR Calculator — Bitwise Exclusive OR with Binary View [Online calculator]. TG we-Calculate. https://we-calculate.com/mt/calculator/xor-calculator
TG we-Calculate Editorial Team. "XOR Calculator — Bitwise Exclusive OR with Binary View." TG we-Calculate. 2026. https://we-calculate.com/mt/calculator/xor-calculator.
TG we-Calculate Editorial Team, "XOR Calculator — Bitwise Exclusive OR with Binary View," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/mt/calculator/xor-calculator
@misc{wecalculate_xor_calculator, title = {XOR Calculator — Bitwise Exclusive OR with Binary View}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/mt/calculator/xor-calculator}}, year = {2026}, note = {TG we-Calculate} }
Dan il-kalkulatur għenek?
