Bitwise Calculator

Calculate AND, OR and XOR for two whole numbers.

Result

8
14
6

How it is calculated

The tool converts both numbers to binary and combines them bit by bit. AND gives 1 only where both numbers have a 1, OR gives 1 where at least one has a 1, and XOR gives 1 where exactly one has a 1. The three results are shown as ordinary decimal numbers. Inputs must be whole numbers; a value with a fractional part returns no result. Enter plain decimal numbers (for example 255, not FF or 11111111). Negative integers are handled in 64-bit two's complement, the way programming languages do it, so keep values in the 64-bit range. This is different from arithmetic: 12 AND 10 is not a sum or a product of 12 and 10.

Worked example

Take a = 12 and b = 10. In binary, 12 is 1100 and 10 is 1010. AND: 1100 and 1010 share only the leftmost 1, giving 1000 = 8. OR: any 1 counts, giving 1110 = 14. XOR: positions where the bits differ, giving 0110 = 6.

Try this example →

Common mistakes

  • Typing a binary or hexadecimal string such as 1100 or FF; the tool reads it as a decimal number.
  • Confusing XOR with the power operator, since some languages write ^ for both ideas.
  • Entering decimals like 2.5; only whole numbers are accepted.
  • Expecting the result to be a sum, for instance thinking 12 OR 10 is 22.
  • Mixing up AND with the logical && of programming languages, which tests true or false rather than individual bits.

About this calculator

This calculator computes the bitwise AND, OR and XOR of two integers by comparing them bit by bit in binary: AND returns a 1 only where both numbers have a 1 in that position, OR returns a 1 where either number does, and XOR (exclusive or) returns a 1 only where exactly one of the two does. These operations work on the raw binary representation of a number, not its decimal value, which is what makes them behave so differently from ordinary arithmetic.

Programmers use bitwise operations constantly for tasks like setting or checking individual flags packed into a single integer, working with permission bits, manipulating pixel colors in graphics code, and low-level performance tricks in embedded and systems programming. This calculator lets you verify the result of a bitwise expression by hand before or instead of running it in code.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators