Bitwise AND Calculator
Result
A AND B (decimal) 0
A AND B (binary) 0
The Bitwise AND Calculator computes the bitwise AND of two integers: each output bit is 1 only when the matching bit is 1 in both numbers. The formula used is: result = A & B. It also shows the result in binary.
Formula
AND Result = A & B
- The Bitwise AND Calculator combines two integers bit by bit and updates instantly when you change either value.
- Formula: result = A & B
- Input definitions: • Value A: the first integer (its bits are compared) • Value B: the second integer (its bits are compared)
- Each output bit is 1 only if the corresponding bit is 1 in both A and B; otherwise it is 0.
- Values are truncated to integers and evaluated as 32-bit signed numbers, matching how JavaScript performs bitwise operations.
- Practical tip: AND with a mask (e.g. & 0xFF) isolates specific bits — handy for flags and low-level encoding.
Example Calculation
Inputs
- Value A (integer): 10
- Value B (integer): 20
10 is 01010 and 20 is 10100 in binary. They share no 1-bits in the same position, so 10 & 20 = 0 (00000).
Frequently asked questions
What is a bitwise AND?
It compares two integers bit by bit. Each result bit is 1 only when both inputs have a 1 in that position, so AND is often used to test or mask specific bits.
When should I use this calculator?
Use it for programming and digital-logic tasks — checking flags, applying bit masks, or verifying low-level binary operations.
What inputs should I enter?
Enter two whole numbers. Decimals are truncated to integers before the operation.
How accurate are the results?
The result is exact. It is shown in both decimal and binary, evaluated as 32-bit signed integers.
How do I interpret the result?
A 1 in any bit position means both inputs had a 1 there. Anding with a mask like 0xFF keeps only the lowest 8 bits.
How can I verify the calculation manually?
Use the displayed formula and work through the numbers step by step. If your manual result differs slightly, check rounding and unit conversions first.
Can I use this for planning and budgeting?
Yes. Run best-case, expected, and worst-case inputs to compare outcomes and make safer planning decisions.