Skip to main content

AND Calculator

Our free binary calculator solves andcalculator problems. Get worked examples, visual aids, and downloadable results.

Reviewed by Manoj Kumar, Mathematics Educator

Reviewed by Manoj Kumar, Mathematics Educator

Formula

A AND B: Output bit = 1 only when both input bits = 1

The AND operation compares each bit of two numbers. For each bit position, the result is 1 if and only if both corresponding bits in the inputs are 1. Otherwise the result is 0. This is the most fundamental logical operation in digital computing.

Worked Examples

Example 1: Basic AND Operation with 8-bit Numbers

Problem:Calculate the AND of binary 10110110 (182) and 11010100 (212).

Solution:Align both numbers and apply AND bit by bit:\n 10110110 (182)\n& 11010100 (212)\n----------\n 10010100 (148)\n\nBit 7: 1 AND 1 = 1\nBit 6: 0 AND 1 = 0\nBit 5: 1 AND 0 = 0\nBit 4: 1 AND 1 = 1\nBit 3: 0 AND 0 = 0\nBit 2: 1 AND 1 = 1\nBit 1: 1 AND 0 = 0\nBit 0: 0 AND 0 = 0

Result:10110110 AND 11010100 = 10010100 (decimal 148, hex 0x94)

Example 2: Subnet Mask AND Operation

Problem:Find the network address by ANDing IP 192.168.5.130 with subnet mask 255.255.255.192.

Solution:Convert last octet to binary:\n130 = 10000010\n192 = 11000000\n\nAND operation on last octet:\n 10000010 (130)\n& 11000000 (192)\n----------\n 10000000 (128)\n\nFirst three octets: 192 AND 255 = 192, 168 AND 255 = 168, 5 AND 255 = 5

Result:Network address: 192.168.5.128 (the host is on the .128 subnet)

References

Reviewed by Manoj Kumar, Mathematics Educator · Editorial policy