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.
Input
Result
Enter two binary numbers, then press Calculate.
How it works
- Add: work right to left. 0+0=0, 0+1=1, 1+1=10 (write 0, carry 1). The carry row shows the carry arriving at each column. Example: 1011 + 110 = 10001 (11 + 6 = 17).
- Subtract: 0−1 borrows from the next column (the column becomes 2, so 2−1=1). The borrow row shows the 1 that a column gives up because the column to its right had to borrow. Example: 1000 − 11 = 101 (8 − 3 = 5).
- Multiply: for every 1 bit in B, shift A left by that bit's position, then add the partial products. Example: 101 × 11 = 101 + 1010 = 1111 (5 × 3 = 15).
- Divide: long division. Bring down one bit of A at a time; if the running remainder is at least B, write 1 in the quotient and subtract B, otherwise write 0. Example: 1101 ÷ 10 = 110 remainder 1 (13 ÷ 2 = 6 r 1).
- Bit width and overflow: leave blank for unlimited size. With a width, both inputs must fit, and results wrap modulo 2width. Overflow means an add or multiply result needed more bits than the width; for subtract it means A < B (a borrow out of the top bit), so the result wraps.
- Unsigned only: this version treats every number as non-negative. For signed values see the two's complement calculator. Values use BigInt, so they are exact. Nothing is sent anywhere.
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.
| Question | Binary working | Answer |
|---|---|---|
1011 + 110 (11 + 6) | carry row 01100, sum row 10001 | 10001 = 17 |
1000 − 11 (8 − 3) | borrow row 1110 | 101 = 5 |
101 × 11 (5 × 3) | partial products 101 + 1010 | 1111 = 15 |
1101 ÷ 10 (13 ÷ 2) | 4 bits brought down | quotient 110 (6), remainder 1 (1) |
11111111 + 1 at 8 bits | exact value 256 | 00000000 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.
- MDN: BigInt (retrieved 2026-10-26): exact whole-number arithmetic with no rounding, which is why very long values convert without error.
- MDN: Addition (+) (retrieved 2026-10-26): BigInt operands add exactly.
- MDN: Division (/) (retrieved 2026-10-26): BigInt division truncates toward zero.
- ECMAScript Language Specification: the BigInt type (retrieved 2026-10-26): arbitrary-precision integers.
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.