How this instrument works
Subtracting one number from a larger one, both within the 4-bit range (0 to 15), gives a result that itself always fits comfortably within 4 bits — unlike addition, which can overflow past 15, subtracting a smaller number from a larger one can never produce a result bigger than the larger number you started with.
The actual subtraction is carried out here in ordinary decimal arithmetic and then broken back down bit by bit, sidestepping the manual borrowing a hand calculation in pure binary would need column by column. That manual borrowing is the binary equivalent of this site's Long Subtraction page, which demonstrates the identical mechanic in decimal instead — a column's top digit falling short of what's being taken away, requiring a borrow from the column to its left.
This page requires the first number to be at least as large as the second, keeping every result non-negative and representable in plain 4-bit binary without needing a separate sign bit or two's-complement encoding, both of which this site covers on their own dedicated pages.
- Enter the larger number (0 to 15) into the First number field.
- Enter the number being subtracted into the Second number field.
- Read the four Difference bit fields — the result's own binary digits.
- Multiply each bit by its place value (8, 4, 2, 1) and add them together to confirm the total matches the expected decimal difference.
Worked example — 11 minus 7
11 (1011) minus 7 (0111) leaves 4 in decimal, which converts to 0100 in binary. A hand calculation done entirely in binary would need to borrow across several columns to reach this same answer; computing the difference directly and then converting the result skips that borrowing chain entirely.
15 (1111) minus 15 (1111) leaves 0 (0000) — any number minus itself always clears every bit. 9 (1001) minus 2 (0010) leaves 7 (0111), a case needing no borrowing at all in a manual binary subtraction, since every one of 9's active bits already sits above the corresponding bit in 2.
Questions
Why must the first number be at least as large as the second?
So the result always stays non-negative and representable directly in plain 4-bit binary — subtracting a larger number from a smaller one would need a negative representation, like two's complement, which this site covers on its own separate page.
How is this different from the Long Subtraction page on this site?
That page demonstrates the borrowing mechanic explicitly in decimal, column by column; this page performs the identical subtraction in ordinary arithmetic and then shows the result broken down bit by bit in binary, the base computers actually use internally.
Can binary subtraction ever overflow like binary addition can?
Not in the sense addition does — subtracting a smaller number from a larger one, both already within the 4-bit range, always produces a result that fits within that same range without any wraparound needed.
What is the smallest possible difference this calculator can compute?
0, whenever the two numbers entered are equal — any number minus itself always converts to 0000, every bit switched off.
How would a negative binary result be represented instead?
Through a signed encoding such as two's complement, covered on this site's own dedicated page, which lets a fixed-width binary number stand in for negative values as well as positive ones.