Binary Calculator

This binary calculator adds, subtracts, multiplies and divides binary numbers and runs AND, OR, XOR, NOT and shifts. Type two strings of 0s and 1s, pick the operation, and you'll get the answer in binary, decimal, octal and hex, with optional 8- to 256-bit words and an overflow flag.

Calculation and content reviewed by EZ Calculators Editorial Team on .

Enter values

Choose arithmetic, bitwise logic, or a shift. Work with exact binary integers or inspect a fixed-width signed or unsigned word with explicit overflow reporting.

Build the scenario below, then calculate for a complete result report.

Runs in your browser

Choose an operation

Arithmetic keeps an exact result; fixed-width modes also reveal the stored word and overflow state.

+
Arithmetic
Bitwise logic
Bit shifts

Enter binary values

Spaces, underscores, and a 0b prefix are accepted and removed before calculation.

Use 0 and 1. Spaces, underscores, and an optional 0b prefix are accepted.
Used by arithmetic and two-operand bitwise operations.

Set number representation

Exact mode has no artificial word boundary. Fixed-width modes expose wrapping and signed interpretation.

A signed fixed-width input is read as a two's-complement bit pattern; the same bits can represent a different unsigned value.

How do you add binary numbers?

Line the numbers up on the right and add column by column, just like decimal, but carry as soon as a column reaches 2. The rules are 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11 (write 1, carry 1). So 1010 + 11 = 1101, which is 10 + 3 = 13 in decimal.

How to use the binary calculator

Choose an operation, then type the first number using only 0 and 1. Spaces, underscores and a 0b prefix are fine and get stripped out, so 0b1010_0011 works. Add a second number for arithmetic or AND, OR and XOR, or a shift count for a shift.

Leave Number interpretation on Exact nonnegative values for ordinary binary math with no size limit. Switch to unsigned or signed two's complement when your problem names a word size, like an 8-bit register or a 32-bit integer.

  1. Pick Add, Subtract, Multiply, Divide, Modulo, a bitwise operation or a shift.
  2. Enter the first binary number, then the second number or the shift count.
  3. Keep exact mode, or choose unsigned or signed and a word size from 8 to 256 bits.
  4. Choose whether to group the digits in 4s or 8s for easier reading.
  5. Press Calculate binary and read the result in binary, decimal, octal and hex.

Binary addition calculator rules

Binary addition has only four facts to learn. Work right to left, and any column that adds up to 2 or 3 writes a digit and carries 1 to the next column.

For 1011 + 110: the right column is 1 + 0 = 1. Next is 1 + 1 = 10, so write 0 and carry 1. Next is 0 + 1 + 1 carried = 10, so write 0 and carry 1 again. The last column is 1 + 1 carried = 10. The answer is 10001, which checks out as 11 + 6 = 17.

The four rules of binary addition
Column sumWriteCarry
0 + 000
0 + 1 or 1 + 010
1 + 101
1 + 1 + 1 (with a carry)11

Binary subtraction calculator rules

Subtraction works column by column too, borrowing when the top digit is smaller. A borrow in binary is worth 2, not 10. So 0 - 1 becomes 10 - 1 = 1 after borrowing from the next column. For 1010 - 0011, the answer is 0111, which is 10 - 3 = 7.

If the second number is bigger, exact mode shows a minus sign. 0011 - 0101 gives -10, which is -2. Choose signed two's complement with a word size if you want the bit pattern a computer would store instead. That same -2 in an 8-bit word is 11111110.

Binary subtraction with borrowing
ColumnResult digitBorrow from the next column
0 - 00No
1 - 01No
1 - 10No
0 - 11Yes

Binary to decimal

Each place in a binary number is worth double the place to its right: 1, 2, 4, 8, 16 and so on. Add up the place values wherever there's a 1. 10110 is 16 + 4 + 2 = 22, and 11111111 is 255.

The calculator shows the decimal value of both numbers you enter and of the answer. To convert a single number, enter it, choose Shift left and set the shift count to 0. The result is the same number shown in decimal, octal and hexadecimal.

Formula guide
  • Decimal value = sum of (bit x 2^position), counting positions from 0 on the right
Binary to decimal examples
BinaryPlace values with a 1DecimalHex
10108 + 210A
11018 + 4 + 113D
1011016 + 4 + 22216
10110132 + 8 + 4 + 1452D
11111111128 + 64 + 32 + 16 + 8 + 4 + 2 + 1255FF

Two's complement and overflow

Computers store numbers in a fixed number of bits. In signed two's complement, a leading 1 means the number is negative, and you read it by subtracting 2 to the power of the word size. In 8 bits, 11111101 is 253 unsigned, or 253 - 256 = -3 signed. An 8-bit signed word holds -128 to 127, and an unsigned one holds 0 to 255.

Overflow happens when the true answer doesn't fit. Unsigned 8-bit 11111111 + 1 is 256 in exact math, but only the low 8 bits are kept, so the stored word is 00000000. Signed 01111111 + 1 is 128 in exact math, but it's stored as 10000000, which reads as -128. The calculator shows the exact answer and the stored word side by side and flags overflow.

Formula guide
  • Signed value = unsigned value - 2^w when the leading bit is 1
  • Signed range for w bits: -2^(w-1) to 2^(w-1) - 1

Bitwise operations and shifts

Bitwise operations compare the numbers position by position. AND gives 1 only where both bits are 1. OR gives 1 where either is 1. XOR gives 1 where they differ. For 1100 and 1010, AND is 1000, OR is 1110 and XOR is 0110. NOT flips every bit, so it needs a word size to know where to stop.

A left shift by k places multiplies by 2 to the k. A right shift drops the lowest k bits. In signed mode, a right shift copies the sign bit into the empty places, while unsigned mode fills them with zeros.

Worked binary examples

Each row shows what the calculator returns. The spaces in 8-bit results are only grouping and don't change the value.

Binary calculator examples
SetupBinary resultDecimalNote
1010 + 11, exact11011310 + 3
1010 - 0011, exact111710 - 3
1010 x 11, exact111103010 x 3
10101 / 100, exact101 remainder 15 remainder 121 / 4
1100 AND 1010, exact10008Shared 1 bits only
11111111 + 1, unsigned 8-bit0000 00000 stored, 256 exactOverflow
NOT 00001111, unsigned 8-bit1111 0000240Every bit flipped

Sources

FAQ

What is 1 + 1 in binary?

1 + 1 = 10 in binary. That's the number 2: write 0 in the current column and carry 1 to the next one, the same way 9 + 1 carries in decimal.

What is 1111 + 1 in binary?

1111 + 1 = 10000. Every column carries, so all four 1s become 0s and a new 1 appears on the left. In decimal that's 15 + 1 = 16.

How do I convert 255 to binary?

255 is 11111111, eight 1s, because 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. It's the largest value an unsigned 8-bit byte can hold.

Can the calculator show negative binary answers?

Yes. In exact mode a negative result gets a minus sign, so 11 - 101 shows -10. In signed mode you get the two's complement bit pattern for your word size instead.

How does binary division handle remainders?

It returns a whole-number quotient and shows the remainder separately. 10101 / 100 gives 101 remainder 1, which is 21 / 4 = 5 remainder 1. Dividing by zero is rejected.

What is the largest binary number I can enter?

In exact mode each number can be up to 4,096 bits long. In fixed-width mode, numbers must fit the word size you pick, up to 256 bits.

Does the calculator convert binary to hex?

Yes. Every result is shown in binary, decimal, octal and uppercase hexadecimal, and the table lists the hex value of each number you entered.