What this calculator does
This tool computes the three fundamental bitwise logical operations — AND, OR and XOR — between two non-negative integers. Each operand can be entered in decimal (base 10), hexadecimal (base 16), octal (base 8), senary (base 6) or binary (base 2). The result of every operation is then shown in all five bases, so you can read it however your task requires. Values are treated as unsigned and support the full range 0 to \(2^{64} - 1\).
How to use it
Type the first number into the x field and choose the base it is written in. Do the same for the second number y. The base selector only affects how the text is parsed — the operation always runs on the underlying integer value. The output table lists AND, OR and XOR across decimal, hex, octal, senary and binary rows.
The formula explained
The bitwise operations act on the binary representation of each integer, one bit position at a time. AND sets a result bit only when both input bits are 1. OR sets a result bit when at least one input bit is 1. XOR (exclusive OR) sets a result bit when exactly one input bit is 1 — making it ideal for parity and checksum work, since XOR of a value with itself is 0.
$$\begin{gathered} X = \text{parse}\!\left(\text{x},\ \text{base}_x\right), \quad Y = \text{parse}\!\left(\text{y},\ \text{base}_y\right) \\[1.2em] \text{AND} = X \mathbin{\&} Y, \quad \text{OR} = X \mid Y, \quad \text{XOR} = X \oplus Y \end{gathered}$$
Worked example
Take \(x = 115\) and \(y = 234\) (both decimal). In binary, \(115 = 0111\,0011\) and \(234 = 1110\,1010\). AND gives \(0110\,0010 = 98 = \text{hex } 62 = \text{octal } 142 = \text{senary } 242 = \text{binary } 1100010\). OR gives \(1111\,1011 = 251 = \text{hex } fb = \text{octal } 373 = \text{senary } 1055\). XOR gives \(1001\,1001 = 153 = \text{hex } 99 = \text{octal } 231 = \text{senary } 413 = \text{binary } 10011001\).
Bitwise Truth Table
Bitwise operations work on each pair of bits independently. The table below shows every possible combination of two input bits \(A\) and \(B\) and the resulting output bit for AND (\(\&\)), OR (\(\mid\)) and XOR (\(\oplus\)).
| A | B | A AND B (\(A \mathbin{\&} B\)) | A OR B (\(A \mid B\)) | A XOR B (\(A \oplus B\)) |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
In words: AND returns 1 only when both bits are 1; OR returns 1 when at least one bit is 1; XOR returns 1 when the bits differ. When two multi-bit integers are combined, the operation is applied to each aligned bit position separately. For example, combining \(12 = 1100_2\) and \(10 = 1010_2\) bitwise gives AND \(=1000_2 = 8\), OR \(=1110_2 = 14\), and XOR \(=0110_2 = 6\).
Base Digit Conversion Table
Before computing AND, OR or XOR, confirm your operands are entered in the correct base. Senary is base 6 (digits 0–5); octal is base 8 (digits 0–7); hexadecimal is base 16 (digits 0–9 then A–F). The table lists decimal 0–16 across all five supported bases.
| Decimal (10) | Hex (16) | Octal (8) | Senary (6) | Binary (2) |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 10 |
| 3 | 3 | 3 | 3 | 11 |
| 4 | 4 | 4 | 4 | 100 |
| 5 | 5 | 5 | 5 | 101 |
| 6 | 6 | 6 | 10 | 110 |
| 7 | 7 | 7 | 11 | 111 |
| 8 | 8 | 10 | 12 | 1000 |
| 9 | 9 | 11 | 13 | 1001 |
| 10 | A | 12 | 14 | 1010 |
| 11 | B | 13 | 15 | 1011 |
| 12 | C | 14 | 20 | 1100 |
| 13 | D | 15 | 21 | 1101 |
| 14 | E | 16 | 22 | 1110 |
| 15 | F | 17 | 23 | 1111 |
| 16 | 10 | 20 | 24 | 10000 |
You can verify any single value in another base with the binary 1100 converter, which returns decimal 12.
Definitions & Glossary
- Bit
- The smallest unit of digital information, taking the value 0 or 1. Every integer in this calculator is processed as a sequence of bits.
- Bitwise operation
- An operation applied independently to each corresponding bit of two operands. AND, OR and XOR are the three combining operations computed here.
- Base (radix)
- The number of distinct digits a positional numeral system uses. Decimal has base 10, binary base 2, octal base 8, senary base 6 and hexadecimal base 16. Each digit position represents a power of the base.
- Unsigned integer
- A non-negative whole number with no sign bit; all bits contribute to the magnitude. This tool accepts only unsigned values.
- Senary
- Base-6 numbering using digits 0–5. The place values are powers of 6, e.g. \(24_6 = 2\times6 + 4 = 16\).
- Hexadecimal
- Base-16 numbering using digits 0–9 and letters A–F (where A=10 … F=15). Each hex digit maps cleanly to exactly four binary bits.
- Octal
- Base-8 numbering using digits 0–7. Each octal digit maps to exactly three binary bits.
- Mask
- A constant value used with a bitwise operation to select, set or clear specific bits — e.g. ANDing with \(0\text{F}_{16}\) keeps only the low four bits.
- Parity
- Whether the number of 1-bits in a value is even or odd. XOR is the basis of parity checks: the XOR of all bits equals 1 for odd parity and 0 for even parity.
FAQ
Are negative numbers supported? No. Inputs are non-negative unsigned integers; there is no two's-complement sign handling.
What if I enter an invalid digit? A digit outside the chosen base (for example "8" in octal) is ignored/treated as 0, so check your base selection.
Why XOR for checksums? Because XORing a stream of bytes and then XORing the same stream again returns 0, XOR is a simple, reversible way to detect single-bit changes and compute parity.