AI & Computing

Bitwise Calculator (AND, OR, XOR, NOT)

Enter two numbers to see their bitwise AND, OR, XOR and NOT.

Your numbers

Your results

A AND B
A AND B
—
A OR B
—
A XOR B
—
NOT A
—
AND, OR, XOR in hex
—

Bitwise Calculator (AND, OR, XOR, NOT) by TheCalcTools

How the Bitwise Calculator (AND, OR, XOR, NOT) works

Bitwise operators work on each binary digit separately: AND gives 1 where both bits are 1, OR where either is 1, XOR where they differ, and NOT flips every bit within the chosen width.

They are used for flags, masks, permissions, hashing and low-level networking (subnet masks are a bitwise AND).

The formula

AND: 1·1 = 1; OR: 0+0 = 0 else 1; XOR: 1 if bits differ; NOT: 2^width − 1 − A

Worked example

Using the default values shown in the calculator:

First number202
Second number57
Numbers are inDecimal
Width for NOT8-bit
  1. 202 = 11001010 and 57 = 00111001.
  2. AND = 8 (1000); OR = 251 (11111011); XOR = 243 (11110011).

Result:

A AND B8 (1000)
A OR B251 (11111011)
A XOR B243 (11110011)
NOT A53 (110101)
AND, OR, XOR in hex8, FB, F3

Frequently asked questions

How is XOR used?

XOR toggles bits and is reversible: (A XOR K) XOR K = A, which is why it appears in checksums and simple ciphers.

Sources and further reading

More in AI & Computing · All calculators

This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.