Binary Bitwise AND
Perform bitwise AND operation on multiple binary numbers with step-by-step bit-level breakdown and real-time calculation.
What Is Bitwise AND on Binary Numbers?
The bitwise AND operation compares two or more binary numbers bit by bit. Each output bit is 1 only if all corresponding input bits are 1; otherwise the output bit is 0. This operation is fundamental in low-level programming, embedded systems, network masking, permission flags, and digital logic design.
How Bitwise AND Works
Given two binary numbers, align them by their least significant bits (padding shorter numbers with leading zeros), then apply the AND truth table to each column:
- 1 AND 1 = 1
- 1 AND 0 = 0
- 0 AND 1 = 0
- 0 AND 0 = 0
Example: AND of 11001100 and 10101010:
11001100
& 10101010
----------
10001000
Result: 10001000 (decimal 136).
Common Uses of Bitwise AND
- Subnet masking: ANDing an IP address with a subnet mask extracts the network address.
- Permission checks: In Unix-style permissions and flag enums, AND tests whether specific bits are set.
- Clearing bits: AND with a mask clears specific bits while preserving others.
- Parity checking: AND with 1 extracts the least significant bit to test for odd/even.
- Cryptography and hashing: Many algorithms use AND to isolate bit fields.
Frequently Asked Questions
Can I AND more than two binary numbers at once?
Yes. This tool performs the AND operation on all provided binary numbers sequentially — the result of the first two is ANDed with the third, and so on. The final output is equivalent to ANDing all inputs together in one pass.
What happens if the binary inputs have different lengths?
Shorter binary numbers are padded with leading zeros to match the length of the longest input before the AND operation is applied. This ensures all bit positions are correctly aligned and no bits are lost.
What is a bitmask and how does AND relate to it?
A bitmask is a binary pattern used to selectively read, set, or clear specific bits in another value.
ANDing a value with a bitmask isolates only the bit positions where the mask has a 1, zeroing all other positions.
For example, ANDing any number with 00001111 extracts only the lower 4 bits.
Does AND work on signed binary numbers?
The bitwise AND operation itself is sign-agnostic — it operates on raw bit patterns regardless of their interpretation. However, when working with signed representations like two's complement, the result should be interpreted according to the same signed encoding as the inputs.
How is AND different from OR and XOR?
AND outputs 1 only when all inputs are 1 (intersection). OR outputs 1 if any input is 1 (union). XOR outputs 1 only when an odd number of inputs are 1 (difference). Each has distinct applications: AND for masking/clearing, OR for setting bits, XOR for toggling or detecting differences.
Related tools
Your recent visits