Big Number Calculator

Perform exact addition, subtraction or multiplication on large integers.

Reset

Understanding big-number arithmetic

Most calculators and spreadsheets are quietly wrong about large numbers. They store numbers in a format that holds about 15 or 16 significant digits, and anything beyond that is rounded away without warning. Type a 20-digit account total into a spreadsheet and the last digits change to zeros; multiply two 9-digit numbers on a pocket calculator and the answer is shown in scientific notation, rounded to fit the display.

Formula and method

There is no single closed formula here — the method is digit-by-digit integer arithmetic, the same as the paper methods, carried out without any floating-point conversion: Addition: add the numbers column by column from the rightmost digit, carrying tens to the next column whenever a column total reaches 10 or more. A carry can ripple all the way to a new leading digit — that is how 999… + 1 becomes 1000…. Subtraction: subtract column by column from the right, borrowing from the next column whenever a digit is too small. If the second number is larger, the result is negative, and the subtraction is done the other way round with a minus sign attached. Multiplication: multiply every digit of one number by every digit of the other (long multiplication), shift each partial product by its place value, and add the partial products. The number of digit-multiplications grows with the square of the length, which is why this method is slower than floating-point — and why it is exact. Why exactness is possible: the inputs are processed as strings of digits, never converted to a floating-point number. A floating-point number with about 15 significant digits cannot even represent a 20-digit integer exactly; a digit string can represent any length, limited only by the 200-digit input cap on this tool.

Worked example

Example 1 — Addition: 123,456,789,123,456,789,123 + 987,654,321,987,654,321,987 Add column by column from the right. Every column adds to 10 with a carry of 1, except the pattern is easiest to see in groups: 123,456,789 + 987,654,321 = 1,111,111,110 in each three-digit group, with the carries lining up exactly. The exact result is 1,111,111,111,111,111,111,110 (22 digits). A spreadsheet would show this as 1.11111111111111 × 10²¹ and lose the final digits entirely. Here every digit is present and checkable: the result ends in 110, as the last group (123 + 987 = 1,110) requires.