Addition and Subtraction of Integers Calculator

Addition and Subtraction of Integers Calculator

Enter two integers to add or subtract them, with the sign rule explained step by step.

Whole numbers only, positive or negative.
Result -
The move from the first number (gray) to the result (blue) on the number line.

How to use this calculator

Enter your first integer, choose + or \u2212, then enter your second integer. Press Calculate to see the result, the sign rule that applied, and a number line showing the move. Use Reset to clear the fields.

Rules for adding and subtracting integers

When you add two integers with the same sign, add their absolute values and keep that sign. When you add two integers with different signs, subtract the smaller absolute value from the larger one, and keep the sign of whichever number had the larger absolute value.

Subtracting an integer is the same as adding its opposite. So a \u2212 b is always rewritten as a + (\u2212b) first, and then the addition rules above apply.

Quick reference

Same signs, adding: add the absolute values, keep the shared sign. Example: \u22125 + (\u22123) = \u22128.
Different signs, adding: subtract the smaller absolute value from the larger, keep the sign of the bigger number. Example: \u22127 + 4 = \u22123.
Subtracting: flip the sign of the second number, then add. Example: 6 \u2212 (\u22122) becomes 6 + 2 = 8.

Worked examples

\u22127 + 4
Different signs. Subtract the smaller absolute value (4) from the larger (7): 7 \u2212 4 = 3. Keep the sign of the bigger number (\u22127 is bigger in absolute value), so the answer is \u22123.
3 \u2212 (\u22125)
Subtracting a negative flips to adding its opposite: 3 \u2212 (\u22125) = 3 + 5 = 8.

Frequently asked questions

Why does subtracting a negative number give a bigger result?

Subtracting a negative is the same as adding its positive opposite. Taking away a debt is the same as gaining that amount, which is why 3 \u2212 (\u22125) becomes 3 + 5 = 8 instead of getting smaller.

What if both integers are negative?

If you're adding two negatives, add their absolute values and the result stays negative, like \u22124 + (\u22126) = \u221210. If you're subtracting a negative from a negative, it becomes addition of a positive, like \u22124 \u2212 (\u22126) = \u22124 + 6 = 2.

How do I know which number's sign to keep when adding different signs?

Keep the sign of whichever number has the larger absolute value, meaning whichever number is further from zero, regardless of its sign.

Does the order matter for addition?

No. Addition of integers is commutative, so a + b always gives the same result as b + a. Subtraction is not commutative, so a \u2212 b and b \u2212 a give different (opposite-signed) results.