What this calculator does
This tool evaluates any arithmetic expression that uses only addition and subtraction of positive and negative numbers, with optional parentheses for grouping. It accepts integers and decimals, handles unary signs such as (-12) or + -22, and returns the exact answer along with a step-by-step view of the work so you can see how the sign rules are applied.
How to use it
Type an expression such as (-12) - 16 + -22 - (33 - 58) into the box. Use only the digits 0-9, a decimal point, the plus sign +, the minus sign -, and parentheses ( ). Multiplication and division are not supported. Press calculate and the answer appears at the top, with the parsed expression and final value shown underneath.
The sign rules explained
Subtraction is rewritten as addition of the opposite: \(a - b = a + (-b)\). In particular, subtracting a negative becomes adding a positive: $$a - (-b) = a + b$$ When you add two numbers with the same sign, keep the sign and add the magnitudes. When the signs differ, subtract the smaller magnitude from the larger and keep the sign of the larger. Parentheses are evaluated first; everything else is combined left to right.
Worked example
For (-12) - 16 + -22 - (33 - 58): first resolve the parentheses, giving -12 and -25. The expression becomes -12 - 16 + -22 - (-25). Apply the sign changes: \(+ {-22} = -22\) and \(- (-25) = + 25\), so it is -12 - 16 - 22 + 25. Combining left to right: $$-12 - 16 = -28$$ $$-28 - 22 = -50$$ $$-50 + 25 = -25$$ The answer is -25.
More Worked Examples
Each example uses the same two-stage method: first rewrite every subtraction as the addition of an opposite (using \(a-(-b)=a+b\) and \(a+(-b)=a-b\)), then combine the resulting signed terms from left to right.
Example 1 — Subtracting a negative: \(8-(-5)\)
- Two minus signs sit side by side, so apply \(a-(-b)=a+b\): \(8-(-5)=8+5\).
- Add: \(8+5=\) 13.
Example 2 — Adding two negatives: \(-7+(-3)\)
- Adding a negative is the same as subtracting: \(a+(-b)=a-b\), so \(-7+(-3)=-7-3\).
- Both terms are negative, so add their magnitudes and keep the negative sign: \(-(7+3)=\) -10.
Example 3 — Mixed signs crossing zero: \(-4+9-12\)
- The expression is already a chain of additions/subtractions; work left to right.
- First pair: \(-4+9=+5\) (subtract magnitudes \(9-4=5\), take the sign of the larger, \(+\)).
- Next: \(5-12=-7\) (subtract magnitudes \(12-5=7\), take the sign of the larger, \(-\)).
- Result: \(-4+9-12=\) -7.
Example 4 — Decimals: \(2.5-4.75+(-1.25)\)
- Rewrite \(+(-1.25)\) as \(-1.25\): \(2.5-4.75-1.25\).
- Left to right: \(2.5-4.75=-2.25\) (subtract magnitudes \(4.75-2.5=2.25\), sign of larger is \(-\)).
- Then \(-2.25-1.25=-(2.25+1.25)=\) -3.5.
Sign Combination Reference
When two signs appear next to each other (an operator followed by a number's sign), they collapse into a single sign by the rules below. "Like signs give plus, unlike signs give minus."
| Adjacent signs | Combine to | Pattern | Example |
|---|---|---|---|
| + then + | + | \(a+(+b)=a+b\) | \(6+(+2)=8\) |
| + then − | − | \(a+(-b)=a-b\) | \(6+(-2)=4\) |
| − then + | − | \(a-(+b)=a-b\) | \(6-(+2)=4\) |
| − then − | + | \(a-(-b)=a+b\) | \(6-(-2)=8\) |
Note that the two unlike-sign rows give the same numerical action (subtraction), while the two like-sign rows both produce addition. After collapsing the signs, combine the terms left to right.
Key Terms
- Integer
- A whole number with no fractional part, including positives, negatives, and zero: \(\dots,-3,-2,-1,0,1,2,3,\dots\). This tool also accepts decimals, but the same sign rules apply.
- Magnitude (absolute value)
- The distance of a number from zero, written \(|x|\), always non‑negative. For example \(|-7|=7\). When adding numbers with unlike signs you subtract the smaller magnitude from the larger.
- Opposite (additive inverse)
- The number that, added to a given number, gives zero. The opposite of \(b\) is \(-b\), since \(b+(-b)=0\). Subtracting a number is the same as adding its opposite, which is why \(a-(-b)=a+b\).
- Unary sign vs. binary operator
- A unary sign attaches to a single number to mark it positive or negative (the \(-\) in \(-5\)). A binary operator sits between two numbers and tells you to add or subtract them (the \(-\) in \(8-5\)). In \(8-(-5)\) the first \(-\) is binary (subtract) and the second is unary (negative five).
- Operand
- A value that an operator acts on. In \(8-5\), the operands are \(8\) and \(5\) and the operator is subtraction.
FAQ
Can I use decimals? Yes. For example \(1.5 - 2.25 = -0.75\). Whole-number results display without a decimal point.
Does it support multiplication or division? No. This calculator is limited to addition and subtraction; use a full equation solver for other operations.
What happens with bad input? Empty input, disallowed characters, or unbalanced parentheses produce a clear error message instead of a wrong answer.