Binary Calculator with Steps

This binary calculator does arithmetic on base-2 numbers: enter two numbers, pick an operation, and the result appears at once in binary, decimal, hexadecimal and octal. For addition you see the written method with carries, for AND, OR and XOR the bits lined up one under the other.

Source: Wikipedia – Two’s complement (Zweierkomplement, Darstellung negativer ganzer Zahlen). Updated: .

Spaces for grouping are fine; use a minus sign for negative numbers
For shifts: the number of places
Used for AND, OR, XOR and two’s complement
My ToolboxYour inputs are saved in this browser only.

Result

Result in binary
1 0001
Decimal
17
Hexadecimal
11
Octal
21
Two’s complement
0001 0001 (8 bits)
Calculation
1011 + 110 = 11 + 6 = 17
Written addition
43210
Carry11100
A01011
B00110
Sum10001

How it is calculated

The binary system has only the digits 0 and 1, and arithmetic follows the same rules as in decimal, except that a carry already occurs at 1 + 1. Adding 1011 and 110 gives 10001, which is 11 + 6 = 17 in decimal. The calculator does the work and shows the decimal check alongside.

The operations

Negative numbers and two’s complement

Computers store negative integers in two’s complement: invert all bits and add 1. With 8 bits, −1 is therefore 1111 1111 and −128 is 1000 0000. The bit width decides which numbers can be represented (8 bits: −128 to 127 signed, 0 to 255 unsigned). To convert single numbers between systems, use the number base converter, and for text in zeros and ones the text to binary converter. Fractions with a binary point are not supported here; the calculator works with whole numbers.

Frequently asked questions

How do you add binary numbers?

Like column addition in decimal, from right to left: 0+0=0, 0+1=1, 1+1=10 (write 0, carry 1) and 1+1+1=11. Example: 1011 + 110 = 10001 (11 + 6 = 17).

How do you subtract binary numbers?

Either by column subtraction with borrowing or through two’s complement: add the two’s complement of the second number. The calculator gives the result directly, including negative ones, and shows it in two’s complement.

What do AND, OR and XOR mean?

They are bitwise operations. AND gives 1 if both bits are 1. OR gives 1 if at least one bit is 1. XOR gives 1 if the bits differ.

How does two’s complement work?

Invert all the bits of a number and add 1. That lets subtraction be written as addition. In 8 bits, −5 is 1111 1011.

Can the calculator handle binary fractions?

No, it works with whole numbers only. Binary fractional digits stand for 1/2, 1/4, 1/8 and so on; the number base converter handles those.

Sources and legal basis

As of: · Editorial policy

Related tools