Binary Calculator – Arithmetic and Bitwise Operations

= 10 decimal
= 6 decimal
Binary
0b10
Decimal
2
Octal
0o2
Hexadecimal
0x2
What can this binary calculator do?
This tool performs two categories of operations on binary numbers. Arithmetic operations (addition, subtraction, multiplication, integer division, and modulo) treat the inputs as standard integers. Bitwise operations (AND, OR, XOR, NOT, left shift, and right shift) work on the individual bits of each number. Results are displayed simultaneously in binary, decimal, octal, and hexadecimal.
How to add two binary numbers manually?

Binary addition works column by column from right to left, exactly like decimal addition, but with only two digits. There are four possible cases per column:

Bit ABit BCarry inSum bitCarry out
00000
10010
01010
11001
00110
10101
01101
11111

Worked example: 1011 + 0110 (11 + 6 = 17)

ColumnA bitB bitCarry inSum bitCarry out
0 (rightmost)10010
111001
201101
3 (leftmost)10101
4 (overflow)110

Reading the sum bits bottom-up (column 4 → 0): 10001 = 16 + 1 = 17 ✓. The carry that overflows the original bit-width becomes the most significant bit of the result.

How do AND, OR, and XOR work bit by bit?

Bitwise operations compare the two inputs one bit at a time at each position. The truth table below shows the output for every combination of input bits:

ABA AND BA OR BA XOR B
00000
01011
10011
11110

Example: 1100 AND/OR/XOR 1010

Bit positionABANDORXOR
311110
210011
101011
000000

Results: AND = 1000, OR = 1110, XOR = 0110. Common uses: AND to mask (isolate) specific bits, OR to set bits, XOR to toggle bits or compare two values for differences.

How does NOT work?

NOT is a unary operation that takes a single input and flips every bit: 0 becomes 1, 1 becomes 0. The result always has the same number of bits as the input.

Input bitNOT output
01
10

Example: NOT 10110100 = 01001011. Each bit is individually flipped, position by position.

Note: this tool computes NOT within the natural bit-width of your input. NOT of 1010 (4 bits) is 0101, not 11110101 (8 bits). If you need a fixed-width NOT (e.g. 8-bit or 32-bit), pad the input with leading zeros before applying NOT.

How do left shift and right shift work?

Shift operations move every bit in the number left or right by a given number of positions. They are the fastest way to multiply or divide by powers of 2.

Left shift (<<): multiply by 2ⁿ

OperationBinaryDecimal
Original0000 00113
<< 10000 01106 (×2)
<< 20000 110012 (×4)
<< 30001 100024 (×8)

Right shift (>>): integer divide by 2ⁿ

OperationBinaryDecimal
Original0010 010036
>> 10001 001018 (÷2)
>> 20000 10019 (÷4)
>> 30000 01004 (÷8, truncated)

Bits shifted off the end are discarded; right shift truncates toward zero rather than rounding. Shifting left by n positions is identical to multiplying by 2ⁿ as long as no significant bits are lost off the left edge.

What input format is accepted?
Inputs must be binary numbers: strings containing only the digits 0 and 1. The tool does not require a 0b prefix. Enter the raw bit pattern, for example 1101 for decimal 13.
Can results be negative?
Yes. Arithmetic operations like subtraction can produce negative results when Input A is smaller than Input B. Negative results are displayed with a minus sign prefix across all base representations.