About the Binary Calculator
This binary calculator performs arithmetic directly on base-2 numbers. Type two binary values made of 0s and 1s, pick an operation — addition, subtraction, multiplication, division or a bitwise AND, OR or XOR — and it returns the result in binary along with its decimal and hexadecimal equivalents, so you can check each step of your working.
It is aimed at computer science and digital electronics students, programmers debugging bit masks, and anyone learning how computers store numbers. Division gives the whole-number quotient and the remainder, exactly as integer division works in most programming languages, and every result is also shown grouped into 4-bit nibbles so it is easy to read.
Numbers are treated as unsigned magnitudes with an optional leading minus sign (not two’s complement), and arbitrary-precision integers are used so inputs up to 256 bits stay exact. Spaces, underscores and a 0b prefix are ignored, so you can paste values straight from code.
How to use the binary calculator
- 1Type the first binary number using only 0s and 1s.
- 2Choose the operation: add, subtract, multiply, divide, AND, OR or XOR.
- 3Type the second binary number.
- 4Read the binary result, then check it against the decimal and hex values.
- 5For division, note the remainder shown separately.
Formula and method
Binary arithmetic follows the same column rules as decimal, but each column is a power of two. Addition works right to left: when a column sums to 2 you write 0 and carry 1; when it sums to 3 you write 1 and carry 1. Subtraction borrows 2 from the next column. Multiplication is shift-and-add: every 1 in the multiplier adds a shifted copy of the multiplicand.
Division is long division producing an integer quotient and a remainder. The bitwise operators compare numbers bit by bit: AND gives 1 only where both bits are 1, OR where either is 1, and XOR where exactly one is 1. Results are converted to decimal by summing each 1 bit times its power of two.
- bᵢ
- Bit in position i (0 or 1), counting from the right starting at 0
- 2ⁱ
- Place value of position i; value = Σ bᵢ × 2ⁱ
Worked examples
Add 1011 + 110
1011 is 11 and 110 is 6 in decimal. Adding column by column with carries gives 10001, which is 16 + 1 = 17.
Multiply 1101 × 101
1101 (13) × 101 (5) is 1101 shifted two places (110100) plus 1101, giving 1000001 = 65.
Divide 11010 ÷ 100
11010 is 26 and 100 is 4. 26 ÷ 4 = 6 remainder 2, so the quotient is 110 and the remainder is 10 in binary.
Subtract a larger number
101 (5) minus 1100 (12) is −7, which is written as −111 in signed-magnitude binary.
Bitwise XOR of two masks
XOR sets a bit where exactly one input has a 1: 11001010 XOR 10101100 = 01100110, which is 102 or 0x66.
Frequently asked questions
How do you add binary numbers?+
Line the numbers up on the right and add each column: 0+0=0, 0+1=1, 1+1=10 (write 0 and carry 1) and 1+1+1=11 (write 1, carry 1). Work from right to left, carrying into the next column just like decimal addition.
How do you subtract binary numbers?+
Subtract column by column from the right. When you need to take 1 from 0, borrow from the next 1 to the left, which turns the current column into 10 (two). Computers usually subtract by adding the two’s complement instead.
How does binary multiplication work?+
Multiply the first number by each bit of the second: a 1 copies the number, a 0 gives zero. Shift each partial product one place further left, then add them all up. For example 101 × 11 = 101 + 1010 = 1111.
What does 1 + 1 equal in binary?+
In binary, 1 + 1 = 10, which is the number two. You write 0 in the current column and carry 1 to the next column, because binary has only the digits 0 and 1.
Does this calculator use two’s complement for negative numbers?+
No. Negative results are shown with a minus sign in front of the magnitude (signed magnitude), which is how you would write them by hand. To see fixed-width two’s complement, use the number base converter.
What is the difference between AND, OR and XOR?+
They compare bits position by position. AND returns 1 only when both bits are 1, OR returns 1 when at least one bit is 1, and XOR returns 1 when the bits differ. They are used for masks, flags and parity checks.