AND Calculator
CU-28Enter two or more numbers, one per line, and get their bitwise AND in binary, decimal and hex. A result bit is 1 only where every input has a 1 in that position.
Runs in your browser. Nothing is uploaded.
Numbers, one per line (decimal, 0x hex or 0b binary)
AND result
How to use it
- Type or paste the numbers, one per line. Use 0x for hex or 0b for binary, or pick a number type.
- Leave the type on Auto if you mix decimal, hex and binary with prefixes.
- Press Calculate AND.
- Read the inputs padded to one width, then the result in binary, decimal and hex.
What bitwise AND does
Bitwise AND compares two numbers one bit at a time. The result bit is 1 when both bits are 1 and 0 otherwise. With more than two numbers, the result bit is 1 only if every number has a 1 there. A common use is masking: ANDing a value with 0xFF keeps its lowest 8 bits and clears the rest. The tool lines the inputs up at the same width so you can see which columns survive.
How numbers are read
In Auto mode a plain number is decimal, 0x starts a hex number and 0b starts a binary number. Choose Decimal, Hexadecimal or Binary to read every line the same way, which is the way to enter binary digits without a prefix. The width of the output is the widest input. For a binary or hex number that counts the digits you typed, so 0b0001 is four bits wide. Negative numbers and fractions are not accepted.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Number 2 ("abc") is not valid decimal. Expected decimal digits (0-9). | One of the entries contains characters that are not valid for the chosen number type. | Remove the stray characters, or switch the number type so the entry matches. |
AND needs at least two numbers. Put one number on each line. | AND combines numbers, so a single number gives it nothing to work with. | Add at least one more number on its own line. |
Questions people ask
How do I calculate AND of two binary numbers?
Set Number type to Binary, enter one number per line such as 1100 and 1010, and press Calculate AND. Each result bit is 1 only where both inputs have a 1, so 1100 AND 1010 gives 1000 in binary, which is 8 in decimal.
What is the AND of 12 and 10?
12 is 1100 in binary and 10 is 1010. The bits that are 1 in both are the top one, so the result is 1000, which is 8. Enter 12 and 10 on separate lines to see it with the hex value as well.
Can I AND hex numbers?
Yes. Put 0x in front of each hex number in Auto mode, or choose the Hexadecimal type and enter digits only, such as FF and 0F. The result is shown in hex, decimal and binary, padded to the width of the widest input.
Can I AND more than two numbers?
Yes. Put as many numbers as you need on separate lines, or separate them with spaces or commas. The tool combines them all, so a result bit stays 1 only when every single number has a 1 in that position.
Is bitwise AND the same as logical AND?
No. Logical AND works on true and false values and gives one true or false answer. Bitwise AND works on every bit of the numbers separately and gives a number. This tool does the bitwise kind.
About this tool
Combines every number with bitwise AND: a result bit is 1 only where that bit is 1 in all the numbers. The inputs are shown padded to the same width, followed by the result in binary, decimal and hex. The width is the widest input (a binary or hex number counts its typed digits, so leading zeros set the width; a decimal number counts its bit length). Only non-negative whole numbers are accepted, with no sign and no fractions, and underscores inside a number are ignored. Numbers can be separated by new lines, spaces or commas. In Auto mode a plain number is decimal, so binary digits need a 0b prefix or the Binary setting. The arithmetic uses BigInt, so large values are exact. At least two numbers are needed. This is the bitwise operation, not a true/false logic table and not a two-operand expression parser; for expressions with several operators use the bitwise calculator.