Advertisement

AND calculator

Keep only the bit positions that are set in both input patterns. Choose binary, octal or decimal entry and inspect each bit in the result.

Calculator

Binary result
00001000
Octal result
10
Unsigned decimal
8
Signed decimal (two's complement)
8
One operation per bit
PositionABResult
7000
6000
5000
4000
3111
2100
1010
0000

Advertisement

How this calculator works

AND masks unwanted bits. A mask bit of 1 preserves the matching input bit, while a mask bit of 0 clears it. Inputs must fit the selected width. Short binary patterns receive leading zeros. Decimal negatives use two's complement and must be at least -2^(n-1). The signed output interprets the top bit as a negative place value; the unsigned output reads the same pattern as nonnegative.

Formula

At each position, a AND b = ab. The result bit is 1 only for the pair (1, 1).

Worked example

In four bits, 1100 AND 1010 = 1000. The decimal values are 12 AND 10 = 8.

Advertisement

Frequently asked questions

How is AND different from ordinary arithmetic?

It acts separately on each bit position without carrying between columns. The table shows the input pair and output bit for every position.

What happens at the limits?

AND with zero clears the whole pattern; AND with all ones leaves it unchanged.

Can I use more than 32 bits?

Yes. Choose a preset through 64 bits or a custom width from 1 to 256. Text entry preserves every digit, including leading zeros.

Why can signed and unsigned results differ?

They interpret one stored pattern differently. If its highest bit is 1, two's complement subtracts 2^n from the unsigned value.

Sources

Advertisement