Bitwise Calculator

Find AND, OR and XOR of two numbers.

AND (a & b) 8
OR (a | b) 14
XOR (a ^ b) 6

Formula: compare bits position by position

Step-by-step with your numbers:
1. Values used:
2. Number A = 12
3. Number B = 10
4.
5. AND (a & b) = 8
6. OR (a | b) = 14
7. XOR (a ^ b) = 6
Did we solve your problem today?

Perform the core bitwise logic operations on two integers.

How the Math Works

The Bitwise Calculator operates by comparing the binary representation of two numbers bit by bit, starting from the rightmost (least significant) bit. For each corresponding bit position, it applies the logic of AND, OR, or XOR operations: AND returns 1 only if both bits are 1, OR returns 1 if either bit is 1, and XOR returns 1 if the bits are different. This process continues for all bit positions, and the resulting bits are combined to form the final output number in decimal form.

Practical Applications

To use this calculator for practical problem-solving, first convert your two numbers into binary format or enter them directly if the calculator supports decimal input. Select the desired operation (AND, OR, or XOR), and the tool will automatically align the binary digits by their positional values, perform the bitwise logic, and display the result. This is particularly useful in programming for masking bits, in cryptography for manipulating binary data, and in digital circuit design for logic gate simulations.

Day-to-Day Use

In everyday technology use, bitwise operations help manage permissions in computer systems (like file access rights using AND/OR), enable efficient data storage by packing multiple flags into a single number, and optimize performance in applications such as graphics processing where XOR can quickly toggle pixel states. Understanding these operations also aids in troubleshooting network configurations, where subnet masks rely on bitwise AND calculations to determine network and host portions of IP addresses.

Worked example

12 & 10 = 8, 12 | 10 = 14, 12 ^ 10 = 6.

FAQ

See the bits?

Use the Number Base converter to view binary.