Big Number Calculator

Arbitrary-precision integer arithmetic and conversions (BigInt).

The Big Number Calculator does exact integer arithmetic on numbers far larger than a normal JavaScript number can hold. It supports add, subtract, multiply, divide, modulo, power and gcd, and shows the result in decimal, hexadecimal and binary. Use it for checking cryptography values, factorials, IDs and any calculation where rounding is not acceptable.

What is arbitrary-precision integer arithmetic?

Ordinary JavaScript numbers are 64-bit floating-point values, which represent integers exactly only up to 2^53 - 1, about 9 quadrillion. Beyond that, digits are lost to rounding. Big integers, called BigInt in JavaScript, store as many digits as memory allows and keep every digit exact. This tool parses your input as BigInt and applies integer operations. Division is integer division that truncates toward zero, so 7 / 2 is 3 and -7 / 2 is -3. The modulo result takes the sign of the first number, so -7 mod 2 is -1. The gcd is the greatest common divisor, the largest integer that divides both numbers evenly. Results can be read in base 10, base 16 or base 2.

How to use Big Number Calculator

  1. Enter Number A and Number B Type or paste integers into the two text areas. Hex, binary and octal prefixes work.
  2. Choose the Operation Pick one of A + B, A - B, A x B, A / B, A mod B, A ^ B or gcd.
  3. Read the result Decimal, Hexadecimal and Binary boxes appear with the result. If there is a problem, a message shows instead.
  4. Copy a representation Use the copy button on whichever of the three boxes you need.

Frequently asked questions

Why not just use a normal calculator?

Standard floating-point numbers are exact only up to 2^53 - 1. A big-integer calculator keeps every digit, which matters for cryptographic keys, hashes, factorials and large IDs.

Does it handle decimals or fractions?

No. Only integers are accepted and division returns the truncated integer quotient. Use mod to get the remainder.

How are negative numbers shown in hex and binary?

As a minus sign followed by the magnitude, for example -0xff. It is not a two's complement bit pattern.

What does gcd compute?

The greatest common divisor of A and B, ignoring signs. It uses the Euclidean algorithm.

Why is there a size limit?

Huge inputs or powers can take a long time to compute and render. The caps are 5000 characters per number, exponents up to 20000, and powers whose result would be extremely large are refused with Result would be too large.

Are my numbers sent anywhere?

No. The arithmetic runs in the page and the values are not sent to a server.