All tools › Math Calculators › Algebra
Do arithmetic on binary numbers and convert between binary, octal, decimal and hexadecimal.
Add, subtract, multiply and divide binary numbers, or convert between bases
Binary is the base 2 number system: it has only the digits 0 and 1, and each place is worth twice the place to its right. This binary calculator does arithmetic on two binary numbers and shows the answer in binary, decimal, hexadecimal and octal. For addition it also lays out the sum column by column with every carry.
A second mode converts a single whole number between binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16).
How to use the binary calculator
- In What to do, choose binary arithmetic or converting a number between bases.
- For arithmetic, type Binary number A and Binary number B using only 0 and 1. Spaces are ignored, so 1011 0110 is fine.
- Choose the Operation: A + B, A – B, A x B, A / B, or the digit-by-digit operations AND, OR and XOR.
- For a conversion, type the Number to convert and set From base and To base. Hexadecimal letters can be upper or lower case.
- Press the button. Use the Copy button to copy the main result.
How binary arithmetic works
0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1), 1 + 1 + 1 = 11 (write 1, carry 1)
Addition runs from the rightmost column to the left like decimal addition, except that a column overflows at 2 instead of 10. The calculator reads each binary number into its value, does the operation, and writes the result back in each base.
- Subtraction: if B is larger than A, the result is shown with a minus sign. Two’s complement, the fixed-width form computers use for negative numbers, is not used.
- Multiplication: the table lists one shifted copy of A for each 1 digit of B. Those partial products add up to the result.
- Division: whole-number division, giving a quotient and a remainder.
- AND, OR, XOR: compare the two numbers one column at a time, after lining them up on the right.
| Digit of A | Digit of B | AND | OR | XOR |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
Worked example: 101101 + 11011
Enter 101101 as A, 11011 as B and keep the operation on A + B. The result is 1001000. The rows show the same sum in decimal, 45 + 27 = 72, and the result as 48 in hexadecimal and 110 in octal. The addition table reads from the right:
| Column | Digit of A | Digit of B | Carry in | Sum digit | Carry out |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 0 | 1 |
| 2 | 0 | 1 | 1 | 0 | 1 |
| 3 | 1 | 0 | 1 | 0 | 1 |
| 4 | 1 | 1 | 1 | 1 | 1 |
| 5 | 0 | 1 | 1 | 0 | 1 |
| 6 | 1 | 0 | 1 | 0 | 1 |
| 7 | 0 | 0 | 1 | 1 | 0 |
Reading the sum digits from the bottom row up gives 1001000.
Other runs: 110101 – 1011 = 101010 (53 – 11 = 42), 110101 x 1011 = 1001000111 (583), and 110101 / 1011 = 100 remainder 1001 (4 remainder 9).
Converting between bases
In convert mode, the decimal number 202 becomes 11001010 in binary. The other rows show 312 in octal and CA in hexadecimal, the binary digits grouped in fours as 1100 1010, and the place values of the 1 digits: 128 + 64 + 8 + 2 = 202.
The grouping explains why programmers like hexadecimal: each hexadecimal digit stands for exactly four binary digits. Here 1100 is C and 1010 is A. In the same way, each octal digit stands for three binary digits.
Limits and assumptions
- Whole numbers only, zero or above, in the input. No binary fractions and no minus signs.
- Inputs and results can be at most 253 – 1, which is 9,007,199,254,740,991 or 53 binary digits. Larger sums and products are refused, not rounded.
- Results are not padded to 8, 16 or 32 digits, and there is no overflow or wrap-around as in a fixed-size register.
Frequently asked questions
How do I read a binary number as decimal?
Add the place values of the 1 digits. From the right the places are worth 1, 2, 4, 8, 16 and so on, so 1011 is 8 + 2 + 1 = 11.
What is a bit?
A bit is one binary digit, a 0 or a 1. Eight bits make a byte, which can hold values from 0 to 255.
Why does 1 + 1 equal 10 in binary?
Binary has no digit for two, so the column resets to 0 and 1 is carried to the next place. The binary number 10 means one two and zero ones, which is two.
Do leading zeros change a binary number?
No. 0001011 and 1011 are the same value. The calculator drops leading zeros in its results.
Related calculators
- Modulo Calculator – remainders, the step used when converting to another base by hand.
- Big Number Calculator – exact decimal arithmetic beyond the size limit here.
- Log Calculator – log base 2 tells you how many binary digits a number needs.
- Exponent Calculator – powers of 2 for place values.

