Binary Subtraction Calculator

Your details

The binary number you are subtracting FROM (e.g. 1101 = decimal 13). Use only 0 and 1.
The binary number being subtracted (e.g. 0101 = decimal 5). Use only 0 and 1.
The register size for the calculation. Affects overflow detection and sign interpretation.
Borrow: subtract column by column, borrowing from higher bits. Two's complement: invert B, add 1, then add to A.
Binary result (A - B)Positive result
00001000

The difference expressed in binary, padded to the selected bit width.

Decimal (unsigned)8
Decimal (signed)8
A in decimal13
B in decimal5
OverflowNo
Final borrow0 (no borrow)
A (decimal)13
B (decimal)5
A - B (signed)8

1101 - 0101 = 00001000

  • 1101 (decimal 13) minus 0101 (decimal 5) = 00001000 (decimal 8 unsigned, 8 signed in 8-bit).
  • The borrow method mirrors pencil-and-paper decimal subtraction: when a column has 0 - 1, borrow from the next higher bit, turning that bit from 1 to 0 and giving the current column 2 to work with.

Next stepTo verify: convert the binary result 00001000 back to decimal using positional weights (powers of 2). It should equal 8.

= Powered by OnlyCalculators