Borrow sixteen
Hex Subtraction Calculator
Subtract two hexadecimal values, with the borrowing rule and negative results explained.
—
—
—
—
The one rule that changes
A borrow in hex brings sixteen across, not ten. That is the whole difference from decimal subtraction.
| Decimal thinking | Hex reality |
|---|---|
| 9 + 1 = 10, carry | F + 1 = 10, carry |
| A column holds 0–9 | A column holds 0–F |
| Carry means +10 | Carry means +16 |
| Borrow takes 10 | Borrow takes 16 |
Borrowing, step by step
40
- 1B
----
ones: 0 - B cannot be done
borrow from the 16s column
the 4 becomes 3, the 0 becomes 16
16 - 11 = 5 → 5
16s: 3 - 1 = 2 → 2
result → 25 (64 - 27 = 37 in decimal)
People borrow 10 out of habit. The column you borrow into gains sixteen, so 0 becomes 16 rather than 10. Getting this wrong produces an answer that is off by six per borrow, which is just plausible enough to slip through.
A longer example
2668 - 0C3D ------ ones: 8 - D → borrow: 24 - 13 = 11 → B 16s: 5 - 3 = 2 → 2 (6 became 5) 256s: 6 - C → borrow: 22 - 12 = 10 → A 4096s: 1 - 0 = 1 → 1 (2 became 1) result → 1A2B (9832 - 3133 = 6699 in decimal)
Negative results and two's complement
Subtracting a larger value from a smaller one gives a negative number. This calculator shows it with a minus sign, which is the mathematically honest answer.
Hardware does something different. With no sign to store, a processor wraps to the two's
complement value at its register width, which is why 00 − 01 reads as
FF on an 8-bit machine.
| Subtraction | Exact answer | 8-bit register | 32-bit register |
|---|---|---|---|
| 00 − 01 | −1 | FF | FFFFFFFF |
| 00 − 80 | −128 | 80 | FFFFFF80 |
| 10 − 20 | −16 | F0 | FFFFFFF0 |
Read those hardware values back with the hex to decimal converter using the signed width chips, and they come out negative again.
A shortcut for subtracting from a power of sixteen
Subtracting from 100, 1000 and so on is easy once you notice that every
column except the last borrows from a value of F.
100 - 2F think of 100 as FF + 1 FF - 2F = D0 (no borrowing needed — F minus anything works) D0 + 1 = D1 check: 256 - 47 = 209 = D1 ✓
Frequently asked questions
How do I subtract hexadecimal numbers?
Work right to left as in decimal, but each borrow brings sixteen into the column rather than ten.
What is 40 - 1B in hex?
25. In decimal that is 64 minus 27, which is 37.
How much does a borrow bring across?
Sixteen. A 0 that borrows becomes 16, not 10. Borrowing ten is the most common hex subtraction error.
What if the result is negative?
This calculator shows a minus sign. Hardware would instead wrap to a two's complement value, so 00 minus 01 becomes FF in an 8-bit register.
What is 00 - 01 in hex?
Mathematically -1. In an 8-bit register it is FF, and in a 32-bit register FFFFFFFF.
Is there a shortcut for subtracting from 100?
Yes. Treat 100 as FF plus 1, subtract from FF with no borrowing at all, then add 1 back.