Compute inclusive OR and exclusive OR (XOR) for up to 4 inputs — see truth tables, bit-by-bit visualization, binary/hex output, and Boolean algebra laws.
The OR operation is the logical counterpart of "at least one condition is true." In Boolean algebra, inclusive OR returns true whenever one or more inputs are true, making it the natural choice for merging flags, combining search filters, or modelling union operations. Its sibling, exclusive OR (XOR), returns true only when an odd number of inputs are true — essential for parity checks, toggles, and simple encryption.
At the bitwise level, OR sets a bit in the result to 1 whenever at least one corresponding input bit is 1. This is commonly used to set specific bits in a register or to combine permission flags. XOR, on the other hand, flips bits where the inputs differ, making it invaluable for checksums, swapping values without a temporary variable, and error-detection codes.
This calculator supports both inclusive and exclusive OR in logical and bitwise modes with up to four inputs. Choose 4-, 8-, 16-, or 32-bit width and get the result in decimal, binary, and hex along with a colour-coded bit-by-bit visualisation. The side-by-side truth-table reference contrasts OR and XOR at a glance, and the Boolean-algebra-laws table summarises the identities you need for simplification. An explanation panel highlights the key difference between inclusive and exclusive OR. Whether you are debugging network code, studying digital logic, or simplifying Boolean expressions, this tool has you covered.
Bitwise OR and XOR look similar on paper but produce different results whenever both bits are 1, and mixing them up is a common source of bugs. This calculator shows inclusive OR and exclusive OR side by side, with full binary breakdowns for 8-, 16-, or 32-bit operands, so the difference is immediately visible. It supports up to four inputs and both logical (true/false) and bitwise (integer) modes, making it useful for flag manipulation, permission masks, checksum verification, and digital-logic homework.
OR: result bit = 1 if any input bit is 1 | XOR: result bit = 1 if odd number of input bits are 1
Result: OR → 15 (0b1111), XOR → 15 (0b1111)
1010 OR 0101 = 1111 because at least one bit is 1 in each position. XOR gives the same result here since no position has both bits as 1.
Inclusive OR outputs 1 when at least one input is 1, including the case where both are 1. Exclusive OR (XOR) outputs 1 only when the inputs differ. For bits 1 and 1: OR gives 1, XOR gives 0 — that single difference drives their distinct applications. In everyday language, "or" is usually inclusive ("tea or coffee" allows both), while "either … or" often implies exclusivity.
Bitwise OR is the standard way to set flags: `permissions | WRITE_FLAG` turns on the write bit without disturbing others. XOR is used for toggling bits, simple encryption (XOR cipher), swap-without-temp (`a ^= b; b ^= a; a ^= b;`), and error-detection codes like CRC and parity. In networking, XOR of a set of RAID stripes produces the parity stripe, enabling single-disk recovery.
De Morgan's Laws connect OR to AND through negation: NOT(A OR B) = (NOT A) AND (NOT B), and NOT(A AND B) = (NOT A) OR (NOT B). These identities let hardware designers convert between OR-based and AND-based circuits freely. XOR has its own identity family: A XOR B = (A AND NOT B) OR (NOT A AND B), and A XOR A = 0. Understanding these equivalences is essential for logic minimisation and circuit optimisation.
Inclusive OR is true when at least one input is true (including both). XOR (exclusive OR) is true only when the inputs differ — if both are true, XOR returns false.
Setting specific bits in a value. OR with a mask turns on the masked bits without affecting others.
XOR is its own inverse (A ⊕ B ⊕ B = A), making it a simple, reversible operation used as a building block in stream ciphers and one-time pads. Use this as a practical reminder before finalizing the result.
Yes — A OR B equals B OR A for both logical and bitwise operations. Keep this note short and outcome-focused for reuse.
NOT(A OR B) = (NOT A) AND (NOT B). This lets you rewrite OR using AND and negation.
Yes — OR is associative. (A OR B) OR C equals A OR (B OR C). This calculator supports up to 4 inputs.