Saved

Press the star next to a tool's name to save it.

All my tools

Integer Calculator

Use this integer calculator to add, subtract, multiply, divide and raise whole numbers to a power, with long addition and subtraction shown column by column.

Restored your last values ·

Enter two whole numbers, positive or negative, and choose an operation. For adding and subtracting positive numbers, the calculator also shows the long method column by column, with carries and borrows. For division, it gives a quotient and a remainder.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Choose an operation, enter two whole numbers, then press Calculate.

An integer calculator adds, subtracts, multiplies and divides whole numbers, positive or negative, and raises them to a power. It gives exact answers even for numbers with dozens of digits. For adding and subtracting it shows the long method, column by column, with every carry and borrow, and for division it gives the quotient and the remainder. Enter your numbers and press the button. The rules follow the Wikipedia pages on integers and the modulo operation, and the work is done in your browser. It serves as an addition calculator, a long addition calculator and a long subtraction calculator.

How to use the integer calculator

  1. Choose the operation.
  2. Enter the first and second whole number. A minus sign makes a number negative.
  3. Press Calculate.

What integers are

The Wikipedia page describes the integers as zero, the positive whole numbers and their negatives. Numbers such as 21, 4, 0 and −2,048 are integers, while 9.75 and 5/4 are not. The integers are closed under addition, subtraction and multiplication, which means the result is always another integer, but not under division, which is why division gives a quotient and a remainder.

Long addition

Long addition adds the digits place by place, from the ones to the left, and carries 1 whenever a column adds up to 10 or more. For 478 plus 357, the ones column is 8 plus 7, which is 15, so write 5 and carry 1. The tens column is 7 plus 5 plus 1, which is 13, so write 3 and carry 1. The hundreds column is 4 plus 3 plus 1, which is 8. The answer is 835. The calculator prints each of these steps.

Long subtraction

Long subtraction works from the ones as well, and borrows from the next place when the top digit is smaller. For 503 minus 278, the ones column has 3 minus 8, so borrow to make 13 minus 8, which is 5. The tens column has lost 1 to the borrow, so the 0 becomes −1 and needs a borrow too, giving 9 minus 7, which is 2. The hundreds column is then 4 minus 2, which is 2. The answer is 225. If the first number is smaller, the calculator subtracts the other way round and tells you to put a minus sign in front.

Multiplication and powers

Multiplication and powers of whole numbers are exact, however many digits. For instance, 123,456,789 times 987,654,321 is 121,932,631,112,635,269, and 2 to the power 100 is 1,267,650,600,228,229,401,496,703,205,376. A negative number raised to an odd power stays negative, so −3 cubed is −27.

Division with a remainder

For whole numbers a and b, with b not zero, there is exactly one pair of numbers q and r with a equal to b times q plus r, and r at least 0 and less than the size of b. This is called Euclidean division. For 17 divided by 5, the quotient is 3 and the remainder is 2, because 5 times 3 plus 2 is 17. The check line shows the equation. For negative numbers, there are several conventions, which the page on the modulo operation sets out: truncated division rounds the quotient toward zero, floored division rounds it down, and Euclidean division keeps the remainder non-negative. For −7 divided by 3, Euclidean and floored give a quotient of −3 and a remainder of 2, while truncated gives −2 and −1. The calculator shows the other convention when it differs.

A worked example with big numbers

Suppose you need the sum of 99,999,999,999,999,999,999 and 1. A normal calculator would round the answer or show it in scientific notation. This calculator gives exactly 100,000,000,000,000,000,000, and the long method shows the carry moving through every column, one place at a time, until the final carry writes the leading 1.

Negative numbers

Adding a negative number is the same as subtracting its size, and subtracting a negative number is the same as adding its size. For example, 5 minus 9 is −4, and −5 minus 9 is −14. The product of two negative numbers is positive, and the product of a positive and a negative number is negative. When a negative number is raised to a power, the sign of the result depends on whether the power is odd or even: −3 squared is 9, but −3 cubed is −27.

Where whole-number arithmetic matters

Exact arithmetic with long whole numbers is needed in cryptography, in checking calculations in accounting, and in puzzles and number theory, where rounding would destroy the answer. The factorial of 25, for example, has 26 digits, and every one of them matters. The calculator can handle inputs of up to 60 digits, and powers whose results stay below a few thousand digits.

Typing tips

You can type numbers with commas or spaces between the digit groups, such as 1,234,567, and they are read correctly. Leave out decimal points, because this tool is for whole numbers only. A minus sign in front makes a number negative.

Checking an answer

To check an addition, subtract one of the numbers from the sum and you should get the other. To check a multiplication, divide the product by one factor. The calculator's exact arithmetic makes these checks reliable.

Common mistakes

  • Typing decimals. This tool works with whole numbers only.
  • Forgetting a carry or a borrow. The steps show where each one happens.
  • Expecting a negative remainder. The Euclidean remainder is never negative.
  • Mixing up the quotient and the remainder. 17 ÷ 5 is 3 remainder 2, not 2 remainder 3.
  • Dividing by zero. It has no answer.

What next

Use this often? Add Integer to your Home screen.

Frequently asked questions

What is an integer calculator?

A tool that does exact arithmetic with whole numbers, positive or negative, including long addition, long subtraction and division with a remainder.

How does long addition work?

Add the digits place by place from the right and carry 1 when a column reaches 10. 478 + 357 = 835.

How does long subtraction work?

Subtract place by place and borrow from the next place when the top digit is smaller. 503 − 278 = 225.

What is division with a remainder?

a = b × q + r with 0 ≤ r < |b|. For 17 ÷ 5, q = 3 and r = 2.

Is the result exact for very large numbers?

Yes. The calculator uses exact whole-number arithmetic, up to 60 digits per input.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Math Tools