Developer Tools

Binary arithmetic.

Add, subtract, multiply and divide binary numbers and see the working: carry and borrow rows, shift-and-add partial products, and long division with a remainder. Unsigned, exact for very large values, with an optional bit width and overflow flag. Runs in your browser.

Advertisement

Input

Digits 0 and 1 only. A leading 0b, spaces and underscores are ignored. Leave width blank for unlimited size.

Result

Enter two binary numbers, then press Calculate.

Advertisement

How it works

Sources: Wikipedia, Binary number: addition; multiplication; Wikipedia, Division algorithm: unsigned integer division with remainder. To convert text to bytes see the Binary Converter.

Worked examples

These were produced by running this page’s calculator code on 2026-10-26, not typed in by hand.

Binary arithmetic examples
QuestionBinary workingAnswer
1011 + 110 (11 + 6)carry row 01100, sum row 1000110001 = 17
1000 − 11 (8 − 3)borrow row 1110101 = 5
101 × 11 (5 × 3)partial products 101 + 10101111 = 15
1101 ÷ 10 (13 ÷ 2)4 bits brought downquotient 110 (6), remainder 1 (1)
11111111 + 1 at 8 bitsexact value 25600000000 with overflow flagged

Sources and as-of date

As of 2026-10-26. The column rules (carry on 1 + 1, borrow on 0 − 1, shift-and-add, long division) are the ones the code follows; the calculations run on JavaScript BigInt.

Advertisement

Frequently asked questions

Why does 1 + 1 equal 10 in binary?

Binary has only the digits 0 and 1, so two ones make a two, which is written 10: write 0 in the column and carry 1 to the next. That is the same rule as 5 + 5 = 10 in decimal, where the column holds 0 and a 1 carries.

What does the overflow flag mean?

With a bit width set, results wrap modulo 2 to the power of the width. 11111111 + 1 at 8 bits has the exact value 256 but the stored result is 00000000, and the overflow flag is set.

Can I subtract a larger number from a smaller one?

This version is unsigned. If A is smaller than B the subtraction needs a borrow out of the top bit, the result wraps, and the page says so. For negative results use the two’s complement calculator.

How large can the numbers be?

Inputs can be up to 1024 bits long and a fixed width can be up to 256 bits. The arithmetic is exact because it uses BigInt, so nothing is rounded.