Hex Subtraction Calculator
Subtract one hexadecimal number from another instantly and see the full borrow-by-borrow breakdown, plus decimal, binary, and octal results.
How to Subtract Hexadecimal Numbers
Hex subtraction works column by column from the right, exactly like decimal subtraction. The only thing that changes is what borrowing is worth: in decimal, borrowing from the next column adds 10 to the current one; in hex, it adds 16, since hex is base 16.
If a column's top digit is smaller than the digit being subtracted, borrow 1 from the column to its left, add 16 to the current digit, then subtract as normal. That borrow reduces the next column's top digit by 1 before its own subtraction happens.
Hex Subtraction Example, Step by Step
502 − 1A7 = 35B
502 − 1A7 = 35B
5 0 2
− 1 A 7
-------
3 5 B| Step | Description | Result |
|---|---|---|
| Ones place (16^0) | 2 − 7 needs a borrow: (2 + 16) − 7 = 11 decimal = 0xB | write B, borrow 1 |
| 16s place (16^1) | 0 − A, minus the borrowed 1, needs another borrow: (0 − 1 + 16) − 10 = 5 decimal = 0x5 | write 5, borrow 1 |
| 256s place (16^2) | 5 − 1 − borrow 1 = 3 decimal = 0x3 | write 3, no borrow |
Borrowing cascaded across two columns here, the same way subtracting 502 − 107 in decimal would ripple past a zero. A borrow only stops once it lands on a column with enough room to cover it.
Single-Digit Hex Subtraction Reference
Borrowing depends only on whether the top digit is smaller than the bottom one — the actual values involved don't matter beyond that comparison.
| Digits | Result | Borrows? |
|---|---|---|
| 8 − 3 | 5 | No — top digit is larger |
| A − A | 0 | No — equal digits never borrow |
| 3 − 8 | B (after borrowing 16) | Yes — top digit is smaller |
| 0 − F | 1 (after borrowing 16) | Yes — largest possible single-digit borrow |
Common Mistakes When Subtracting Hex Numbers
- Borrowing 10 out of habit instead of 16.
- Stopping a borrow chain too early — if the next column is also too small (or is 0), the borrow has to propagate further left, not just one column.
- Subtracting the digits in the wrong order when a column needs to borrow, instead of adding 16 to the top digit first.
- Forgetting the result can be negative when the second value is larger than the first, and dropping the sign when copying the answer elsewhere.
Frequently Asked Questions
How do you subtract hexadecimal numbers?
Line the numbers up by place value and subtract column by column from the right, same as decimal subtraction. Whenever the top digit is smaller than the bottom digit, borrow 1 from the next column — worth 16 in the current column, not 10.
What happens when you need to borrow in hex subtraction?
Add 16 to the top digit in that column, subtract as usual, and reduce the next column's top digit by 1 before it does its own subtraction. If that next digit is also too small, the borrow keeps cascading left.
What if the second number is larger than the first?
The result is negative. This calculator still computes it — swap the two values, subtract normally, and put a minus sign in front of that result.
Why does hex subtraction borrow 16 instead of 10?
Borrowing pulls one unit from the next column, and each column position is worth 16 times the one to its right in base 16 — the same reason decimal borrowing is worth 10.
Does borrowing ever cascade across more than one column?
Yes. If borrowing leaves the next column's digit too small to subtract from as well, it borrows from the column after that, and so on — the same chain reaction as subtracting 200 - 99 in decimal.
Is hex subtraction related to two's complement?
They solve the same problem two different ways. This calculator subtracts and shows a minus sign for negative results; two's complement instead represents negative numbers within a fixed bit width, which is what hardware actually uses internally.