Binary Calculation
Enter two binary numbers, pick an operation, read the result. Everything updates live as you type.
Binary Calculator
Full calculator (all five bases) → · Binary addition calculator →
How to calculate binary numbers
- Enter the first number. Use only 0s and 1s.
- Pick an operation. + add, − subtract, × multiply, ÷ divide (quotient + remainder).
- Enter the second number. The result updates live below the line.
- Check the other bases. The result is also shown in quinary, octal, decimal, and hex.
Worked examples
| Calculation | Binary result | Decimal check |
|---|---|---|
| 1010 + 1011 | 10101 | 10 + 11 = 21 |
| 1011 − 1010 | 1 | 11 − 10 = 1 |
| 101 × 11 | 1111 | 5 × 3 = 15 |
| 1010 ÷ 10 | 101 remainder 0 | 10 ÷ 2 = 5 |
Rules to remember: 1 + 1 = 0 carry 1. 10 − 1 = 1 (borrow). 1 × 1 = 1, anything × 0 = 0. Dividing by zero is not allowed.
How to calculate binary numbers in code
Python
def binary_calc(a, b, op):
x, y = int(a, 2), int(b, 2)
if op == "+": result = x + y
elif op == "-": result = x - y
elif op == "*": result = x * y
elif op == "/": result = x // y # quotient; remainder is x % y
return bin(result)[2:] if result >= 0 else "-" + bin(-result)[2:]
print(binary_calc("1010", "1011", "+")) # 10101 Java
// Add two binary strings
String sum = Integer.toBinaryString(
Integer.parseInt("1010", 2) + Integer.parseInt("1011", 2)
); // "10101"
// Subtract / multiply: same pattern with - and *.
// Divide: quotient = a / b, remainder = a % b after parsing. C
#include <stdio.h>
#include <string.h>
int binaryToInt(const char *bits) {
int result = 0;
for (size_t i = 0; i < strlen(bits); i++)
result = result * 2 + (bits[i] - '0');
return result;
}
void printBinary(int n) {
if (n == 0) { printf("0"); return; }
if (n < 0) { putchar('-'); n = -n; }
char bits[64]; int i = 0;
while (n > 0) { bits[i++] = (n % 2) + '0'; n /= 2; }
for (int j = i - 1; j >= 0; j--) putchar(bits[j]);
}
int main(void) {
int sum = binaryToInt("1010") + binaryToInt("1011");
printBinary(sum); // prints 10101
return 0;
} These snippets assume valid binary input (only 0s and 1s). RadixFlip validates the input for you.
Frequently asked questions
How do I calculate binary numbers?
Enter the first binary number, pick an operation (+, −, ×, ÷), enter the second binary number, and read the result. Binary addition: 1 + 1 = 0 carry 1. Subtraction borrows 1 (10 − 1 = 1). Multiplication: shift and add. Division: quotient + remainder. Type two numbers in the calculator above and the result updates live.
What is 1010 + 1011 in binary?
1010 + 1011 = 10101 in binary, which is 21 in decimal. Check: 1010 is 10, 1011 is 11, and 10 + 11 = 21.
How do I subtract binary numbers?
Subtract column by column from right to left, borrowing 1 when needed: 0 − 1 needs a borrow (10 − 1 = 1). Example: 1011 − 1010 = 1 in binary (11 − 10 = 1 in decimal). The calculator above handles borrows for you.
How do I multiply binary numbers?
Multiply like decimal, but every partial product is 0 or the other number: 1 × 1 = 1, anything × 0 = 0. Example: 101 × 11 = 1111 in binary (5 × 3 = 15 in decimal). Shift the second number left for each 1-bit and add.
How do I divide binary numbers?
Divide like decimal long division: find how many times the divisor fits, subtract, bring down the next bit, repeat. The answer is a quotient plus a remainder. Example: 1010 ÷ 10 = 101 remainder 0 in binary (10 ÷ 2 = 5 in decimal). Dividing by zero is not allowed.
How do I calculate binary numbers in Python?
Convert with int(x, 2), do the operation in decimal, then convert back with bin(result)[2:]. Example: bin(int("1010", 2) + int("1011", 2))[2:] gives "10101".
Binary addition calculator → · How to convert binary to decimal →