Big Number Calculator
Perform arithmetic with very large integers
How It Works
Overview
A big-number calculator performs exact integer arithmetic on numbers far larger than a normal calculator can represent. Standard floating-point math runs out of precision at 2^53 − 1 (about 9.007 quadrillion); past that, integers silently round. This tool uses JavaScript's native BigInt type, which scales with available memory rather than a fixed bit width, so a 200-digit input is just as exact as a 5-digit one.
Use it for problems where every digit matters: cryptographic moduli, large factorials, combinatorial counts, exact powers of two, and number- theory exploration. The tradeoff for unlimited precision is that BigInt works only on integers — no decimals — and division truncates remainders.
The Formula
Notes on each operation:
- Add / Subtract / Multiply: exact for any integer size.
- Divide: truncates toward zero. 17 ÷ 5 = 3, not 3.4.
- Modulo: returns the integer remainder. 17 mod 5 = 2.
- Power: a^b with non-negative integer b. 2^100 has 31 digits; 2^1000 has 302 digits and still computes instantly.
All operations are deterministic and exact — no floating-point rounding, no scientific-notation truncation in the underlying value.
Worked Example
Computing 2^64:
- Result: 18,446,744,073,709,551,616 (20 digits)
- This is the count of values an unsigned 64-bit integer can hold.
Computing 50! (50 factorial) by repeated multiplication:
- Result: 30,414,093,201,713,378,043,612,608,166,064,768,844,377,641,568,960,512,000,000,000,000
- That's 65 digits, well beyond floating-point exactness.
Computing 123456789012345678901234567890 × 987654321098765432109876543210:
- Result: 121,932,631,137,021,795,226,185,032,733,866,244,107,889,250,490,229,012,104,900
- Exact to every digit; a normal calculator would lose roughly the bottom 30 digits.
When to Use This
- Cryptography homework: RSA modulus multiplication, Diffie-Hellman exponents, modular arithmetic with primes.
- Combinatorics: n! / (k! (n-k)!) for n in the hundreds — bigger than any spreadsheet.
- Powers of two: 2^256 (the size of an SHA-256 keyspace), 2^128, 2^521.
- Number theory: testing divisibility, computing GCDs of huge numbers, exploring primes.
- Verifying spreadsheet output: if Excel returns a suspiciously round number on a large multiplication, recompute here to see the lost digits.
Common Mistakes to Avoid
- Pasting a decimal: 1.5 or 3.14 will throw. Strip the decimal or convert to a fraction first.
- Expecting 7 ÷ 2 = 3.5. Integer division returns 3. Use modulo for the remainder, or scale up: (7 × 1000) ÷ 2 = 3500, then place the decimal.
- Negative exponents: a^-1 is undefined for integers (it would be a fraction). Use a^(-1) mod m only if you need a modular inverse.
- Pasting numbers with hidden formatting. Commas and whitespace are stripped, but exotic Unicode digits or non-breaking spaces from PDFs can cause "Invalid number" errors.
- Performance on extreme inputs: 2^1,000,000 has over 300,000 digits and may freeze the UI for several seconds while rendering.
Frequently Asked Questions
Ad Space