AND Calculator

Compute the bitwise AND of two integers.

Result (decimal) 8
Result (binary) 1000

Formula: result bit = 1 only if both bits are 1

Step-by-step with your numbers:
1. Values used:
2. a (decimal) = 12
3. b (decimal) = 10
4.
5. Result (decimal) = 8
6. Result (binary) = 1000
Did we solve your problem today?

Bitwise AND keeps a 1 only where both inputs have a 1 in the same position.

How the Math Works

The bitwise AND operation compares each corresponding bit of two integers in their binary form. Starting from the rightmost bit, it evaluates pairs of bits: if both bits are 1, the result bit is 1; otherwise, it becomes 0. This process repeats for all bit positions, producing a new integer where each bit reflects the logical AND of the input bits. For example, the binary AND of 5 (101) and 3 (011) yields 1 (001), as only the rightmost bits are both 1.

Practical Applications

This calculation is essential in programming for tasks like masking or filtering specific bits in data. Developers use it to isolate or modify particular bit patterns, such as extracting status flags in hardware registers or checking permissions in file systems. It is also critical in network protocols, where bitwise operations help manage packet headers or configure device settings efficiently.

Day-to-Day Use

Bitwise AND underpins many everyday technologies, from file permissions (e.g., read/write access) to security features in software and hardware. It helps systems determine whether specific conditions are met, such as enabling device drivers or validating user credentials, making digital interactions seamless and secure without users needing to understand the underlying complexity.

Worked example

12 (1100) AND 10 (1010) = 8 (1000).

FAQ

What is AND used for?

Masking bits — keeping only the bits you care about.