Half Subtractor Calculator
Calculate the Difference and Borrow-Out of a half subtractor using one-bit binary inputs A and B. View XOR difference logic, NOT-AND borrow logic, Boolean equations, truth-table values and step-by-step binary subtraction.
What Is a Half Subtractor?
A half subtractor is a combinational digital logic circuit that subtracts one single binary bit from another. The two inputs are normally labeled A and B, where A is the minuend bit and B is the subtrahend bit.
The circuit produces two outputs: Difference and Borrow-Out. Difference represents the low-order subtraction result, while Borrow-Out indicates that the current position needs to borrow from the next higher binary position.
Half subtractors are useful for understanding binary subtraction, Boolean logic and the basic circuits used to construct larger subtractors.
Half Subtractor Boolean Equations
Difference Equation
The Difference output is 1 when A and B are different. Therefore the Difference function is XOR.
Borrow-Out Equation
A borrow is needed only when A is 0 and B is 1.
Half Subtractor Truth Table
| A | B | Difference | Borrow-Out | Meaning |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 − 0 = 0 |
| 0 | 1 | 1 | 1 | Borrow required |
| 1 | 0 | 1 | 0 | 1 − 0 = 1 |
| 1 | 1 | 0 | 0 | 1 − 1 = 0 |
Worked Example 1: 0 − 0
B = 0
Difference:
0 XOR 0 = 0
Borrow:
NOT(0) AND 0
1 AND 0 = 0
Difference = 0
Borrow-Out = 0
Worked Example 2: 0 − 1
B = 1
0 cannot subtract 1 directly.
A borrow is required from the next higher bit.
Difference:
0 XOR 1 = 1
Borrow:
NOT(0) AND 1
1 AND 1 = 1
Difference = 1
Borrow-Out = 1
Worked Example 3: 1 − 0
B = 0
Difference:
1 XOR 0 = 1
Borrow:
NOT(1) AND 0
0 AND 0 = 0
Difference = 1
Borrow-Out = 0
Worked Example 4: 1 − 1
B = 1
Difference:
1 XOR 1 = 0
Borrow:
NOT(1) AND 1
0 AND 1 = 0
Difference = 0
Borrow-Out = 0
Why Does 0 − 1 Produce a Borrow?
At a single binary position, zero does not contain enough value to subtract one. The position must therefore borrow one unit from the next higher binary place.
Because each binary place has twice the value of the position to its right, borrowing one from the next higher position gives binary 10 at the current position.
Difference = 1
Borrow-Out = 1
Half Subtractor Logic Gates
XOR Gate
An XOR gate calculates the Difference because its output is 1 whenever A and B are different.
NOT and AND Gates
The Borrow output is created by inverting A and then ANDing that value with B.
Half Adder vs Half Subtractor
| Feature | Half Adder | Half Subtractor |
|---|---|---|
| Main operation | Binary addition | Binary subtraction |
| Inputs | A, B | A, B |
| Primary output | Sum | Difference |
| Secondary output | Carry | Borrow |
| Primary XOR logic | A XOR B | A XOR B |
| Second equation | A AND B | NOT(A) AND B |
| Incoming carry/borrow | No | No |
Half Subtractor vs Full Subtractor
| Feature | Half Subtractor | Full Subtractor |
|---|---|---|
| Input A | Yes | Yes |
| Input B | Yes | Yes |
| Borrow-In | No | Yes |
| Difference | Yes | Yes |
| Borrow-Out | Yes | Yes |
| Suitable for middle stages | No | Yes |
Limitations of a Half Subtractor
A half subtractor cannot accept a borrow from a previous less significant position. This makes it unsuitable by itself for every stage of general multi-bit binary subtraction.
A full subtractor adds a third input called Borrow-In, allowing the borrow produced by one stage to affect the next stage.
Where Half Subtractors Are Used
Digital Logic Education
Half subtractors demonstrate how simple Boolean gates can implement one-bit binary subtraction.
Subtractor Circuit Design
Half-subtractor logic provides a foundation for understanding full subtractors and larger subtraction circuits.
Boolean Algebra
The circuit provides practical examples of XOR, NOT and AND Boolean operations.
Computer Architecture
Studying subtractor stages helps explain how digital processors perform binary arithmetic at the logic level.
Important Half Subtractor Notes
It does not accept an incoming borrow.
The Difference equation is A XOR B.
Borrow-Out is NOT(A) AND B.
The only input combination that directly creates a borrow is A = 0, B = 1.