Half subtractor: build and simulate it online
X − Y: Difference = X ⊕ Y, Borrow = X̄ · Y.
Build the half subtractor in the free online simulator — it checks your circuit automatically.
What you need
- 2 logic switches labelled X, Y
- 2 probes labelled D, B
- 1 XOR
- 1 NOT
- 1 AND
Step by step
- Inputs and outputs. From the Logic section of the library, drop digital inputs (0/1 boxes) or logic switches for the inputs, and digital outputs or probes for the outputs; give each its label in the inspector (the checker finds them by label). Switches X, Y; Probes D, B
- Three gates. The difference is XOR (like the sum). A borrow happens when X is 0 and Y is 1. XOR, NOT, AND
- Wire and prove. D = X ⊕ Y, B = X̄ · Y. Check all four rows
Truth table
| X | Y | D | B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
Frequently asked questions
How do you build a half subtractor?
X − Y: Difference = X ⊕ Y, Borrow = X̄ · Y. In short: inputs and outputs, then three gates, then wire and prove.
What is the truth table of a half subtractor?
It has 2 inputs (X, Y) and 2 outputs (D, B), so 4 rows. The full table is on this page; the Embedded Lab checks all of them against your circuit.
What parts do you need for a half subtractor?
1 XOR; 1 NOT; 1 AND — plus logic switches for the inputs and probes for the outputs.
Can I simulate a half subtractor online for free?
Yes. Open it in the BitForBytes Embedded Lab, a free browser-based circuit and logic simulator: drag in the gates, wire them, and press "Check my circuit" — every input combination is simulated and marked for you. No download or sign-up needed.
Part of DSD 16 · Half subtractor in the free BitForBytes digital system design course.