Integer Calculator
Enter two integers and choose an operation to get the exact result in one click. The calculator applies the correct sign rules, shows each step of the working, gives you the quotient and remainder for division, and converts the result to binary, octal and hexadecimal so you can see the same number in every common base. Negative numbers are fully supported throughout.
Formula
Worked example
48 divided by 15: 48 = 15 x 3 + 3, so the quotient is 3 and the remainder is 3. In binary: 3 = 11(2). To subtract: 48 - 15 = 33. To multiply: 48 x 15 = 720.
What is an integer?
An integer is any whole number - positive, negative, or zero - with no fractional or decimal part. The set of integers is often written as {..., -3, -2, -1, 0, 1, 2, 3, ...} and extends infinitely in both directions. Integers are fundamental in mathematics because they describe counts, differences, positions on a number line, and many real-world quantities such as temperature change, floors in a building, bank balances, and electrical charge. They are distinct from fractions and decimals, which have parts between whole numbers, and from natural numbers, which typically start at 0 or 1 and contain no negatives.
How to add and subtract integers
Adding integers follows two core rules. When both numbers share the same sign, add their absolute values and keep that sign: -5 + (-3) = -8. When the signs differ, subtract the smaller absolute value from the larger and keep the sign of the number with the larger absolute value: -7 + 4 = -3, because 7 > 4 and the -7 carries the negative sign. Subtraction is handled by the Keep-Change-Change (KCC) rule: keep the sign of the first number, change the subtraction to addition, and change the sign of the second number. So 5 - (-3) becomes 5 + 3 = 8, and -4 - 6 becomes -4 + (-6) = -10. This transforms every subtraction into an addition problem, which the two-rule system above can then solve.
How to multiply and divide integers
Multiplication and division share a single sign rule: two numbers with the same sign give a positive result, and two numbers with opposite signs give a negative result. Multiply or divide the absolute values normally, then apply the sign. For example, (-4) x (-3) = +12 because both signs are negative (same), and (-4) x 3 = -12 because the signs differ. Integer division goes one step further: the decimal remainder is dropped, keeping only the whole-number quotient. 17 divided by 5 gives quotient 3 (not 3.4), with remainder 2, because 5 x 3 + 2 = 17. The relationship a = b x q + r always holds and can be used to verify your answer.
Base conversions: binary, octal and hexadecimal
Any integer can be expressed in different number bases. Binary (base 2) uses only the digits 0 and 1 and is the native language of digital computers: the integer 13 is 1101 in binary. Octal (base 8) uses digits 0-7 and was historically used in computing; 13 in octal is 15. Hexadecimal (base 16) uses digits 0-9 and letters A-F, and is widely used in programming to represent memory addresses and colour codes: 13 in hexadecimal is D. To convert a positive integer to binary, repeatedly divide by 2 and read the remainders bottom to top. For negative integers, the sign is retained as a minus prefix in this calculator (this is sign-magnitude notation, as distinct from two's-complement used inside computers).
Real-world uses of integer arithmetic
Integer arithmetic appears in everyday contexts far beyond the classroom. Bank balances use signed integers: a deposit of $50 and a withdrawal of $70 gives -$20. Temperature change is integer subtraction: if it was -3 C yesterday and -8 C today, the change is -8 - (-3) = -5 C. In computing, integer division and remainders power modular arithmetic, which underlies encryption, hashing, and cyclic scheduling. In physics, electrical charge is quantised in integer multiples of the electron charge. Game developers use integer coordinates for grid-based movement, and programmers rely on integer bit operations for fast low-level data manipulation.
Integer sign rules for arithmetic
| Operation | Signs of a and b | Sign of result | Example |
|---|---|---|---|
| Add | Both positive | Positive | 5 + 3 = 8 |
| Add | Both negative | Negative | -5 + (-3) = -8 |
| Add | Opposite (|a| > |b|) | Sign of a | 7 + (-3) = 4 |
| Add | Opposite (|b| > |a|) | Sign of b | 3 + (-7) = -4 |
| Subtract | Any | Same as a + (-b) | 5 - (-3) = 8 |
| Multiply / Divide | Same sign | Positive | -4 x -3 = 12 |
| Multiply / Divide | Opposite signs | Negative | -4 x 3 = -12 |
| Multiply / Divide | Either is zero | Zero | 0 x any = 0 |
These rules apply to all four operations on any pair of integers.
Frequently asked questions
What is an integer?
An integer is any whole number without a fractional or decimal component. The integers include all positive whole numbers (1, 2, 3, ...), all negative whole numbers (-1, -2, -3, ...), and zero. Numbers such as 1.5 or -3.7 are not integers because they have a decimal part.
How do you add a positive and a negative integer?
Subtract the smaller absolute value from the larger, then keep the sign of the number that has the larger absolute value. For example, 8 + (-5): the absolute values are 8 and 5. Subtract: 8 - 5 = 3. The 8 is larger, so the result is positive: +3. Another example: 3 + (-9): absolute values are 3 and 9. Subtract: 9 - 3 = 6. The 9 is larger and it is negative, so the result is -6.
Why is a negative times a negative positive?
The sign rules for multiplication follow from the distributive property of arithmetic. Multiplying -1 by -1 must produce a value that, added to -1 x 1 = -1, gives zero (since -1 x (1 + (-1)) = -1 x 0 = 0). The only value that makes this work is +1. This extends to all negatives: (-a) x (-b) = +(a x b). It is not arbitrary - it is required for arithmetic to remain internally consistent.
What is integer division and what is a remainder?
Integer division (also called truncating division) divides two integers and discards any fractional part of the result, giving only the whole-number quotient. The remainder is what is left over. For 17 / 5: the quotient is 3 (because 5 goes into 17 three whole times, giving 15), and the remainder is 2 (because 17 - 15 = 2). The check is always: divisor x quotient + remainder = dividend, i.e. 5 x 3 + 2 = 17.
How do I convert an integer to binary?
Divide the integer by 2 repeatedly and record each remainder (0 or 1). Read the remainders from bottom to top to get the binary digits. For example, 13: 13/2 = 6 remainder 1; 6/2 = 3 remainder 0; 3/2 = 1 remainder 1; 1/2 = 0 remainder 1. Reading bottom to top: 1101. To verify: 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1 = 13. For negative integers, prefix a minus sign to the binary of the absolute value.
What is the difference between subtraction and adding a negative?
There is no mathematical difference: subtracting a number is identical to adding its opposite. This is the Keep-Change-Change (KCC) rule - keep the first number, change the minus to a plus, and change the sign of the second number. So 7 - (-4) = 7 + 4 = 11, and -3 - 5 = -3 + (-5) = -8. Rewriting subtraction as addition lets you apply the two simple addition rules rather than memorising separate subtraction rules.
What happens when you divide by zero?
Division by zero is undefined in integer arithmetic (and in all standard mathematics). There is no integer that satisfies n / 0 = q, because no matter what q you choose, 0 x q = 0, not n. This calculator returns no result if you enter 0 as the divisor, which is the mathematically correct behaviour.