Subtract hexadecimal numbers exactly, including negative results – with borrows worth 16 rather than 10, which is where hand calculations usually slip.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
Borrowing sixteen
Hex subtraction borrows a full sixteen: C−F becomes 1C−F = D with the next column docked one. Recalibrating the borrow reflex from ten to sixteen is the entire skill, and tracing a few differences against this page builds it quickly.
Negative differences arrive signed; the fixed-width wraparound a register would show (0x10−0x20 = 0xFFFFFFF0 at 32 bits) belongs to two’s-complement land, one link away.
Worked example
ABC − 9F C−F → borrow: 1C−F = D B−9−1 = 1 A−0 = A Difference: A1D (2748 − 159 = 2589 ✓)
Pointer arithmetic in practice
End minus start gives sizes: two addresses subtract to a region length; sequence numbers subtract to deltas; free-space calculations chain subtractions. All of it is this operation, kept exact and hex-native.
Verification
Difference + subtrahend = minuend, checked in one paste at the addition page: A1D + 9F = ABC. The decimal line supplies a second, independent confirmation.
Privacy
Local computation; operands never leave the browser.
Borrows worth sixteen
The classic stumble in hex subtraction is forgetting that a borrow brings sixteen, not ten: in 0x100 − 0x1 the borrow cascades through both zeros and every column resolves to F, giving 0xFF. This calculator returns exact signed results, so 0x5 − 0xA is simply −0x5. That differs deliberately from what a fixed-width register does: an 8-bit CPU computing 0x05 − 0x0A wraps around to 0xFB, the two’s complement pattern for −5. Comparing the exact answer here with the wrapped answer is a good way to understand unsigned underflow bugs.
How to use the Hex Subtraction Calculator
- Enter minuend and subtrahend (hex).
- Click "Subtract".
- Negative differences are shown with a minus sign; the decimal line verifies.
- Borrows are worth sixteen – the steps spell out the method.
Frequently asked questions
How does borrowing work in hex?
A short column borrows sixteen, not ten: C−F borrows to make 0x1C−F = D. In ABC − 9F: C−F borrow → D carry-borrow; B−9−1 = 1; A−0 = A → A1D. The decimal check (2748−159=2589) confirms.
What does a negative hex result mean?
Pure arithmetic: 0x10 − 0x20 = -0x10. A CPU at fixed width would instead wrap to 0xFFFFFFF0 (32-bit) and set the borrow flag – the two views are related by 2ⁿ, explorable with the complement tools.
Where does hex subtraction show up in practice?
Pointer differences (how many bytes between two addresses), region sizes from start/end pairs in memory maps, and TTL/sequence deltas in packet analysis.
Why do my hand borrows go wrong more in hex?
Habit: decimal training makes 10 the reflex borrow value. Sixteen changes every intermediate. Doing a few examples against the calculator recalibrates the reflex quickly.
Can I check subtraction with addition?
Yes: difference + subtrahend = minuend, in hex. The Hex Addition Calculator is the natural verifier – A1D + 9F = ABC closes the example above.
Does length matter?
No – operands align at the ones place, any length, exactly.
Local execution?
Yes – all in-page.