Skip to content
gohacks.dev
Tooling

Big Integer Calculator

Calculate with integers of any size: addition, subtraction, multiplication, division, remainder, powers, factorials, gcd and lcm, with results in decimal and hex.

Free · No sign-up · Your inputs stay in your browser

Input

Calculate with arbitrarily large integers

Output

Result

Decimal

340282366920938463463374607431768211455

39 digits

Hex

0xffffffffffffffffffffffffffffffff

Binary length

128 bits

Uses JavaScript's BigInt, so there is no limit but memory and no rounding: 2^128 has every one of its 39 digits. That is the difference from a normal calculator or a double, which is exact only up to 2^53. Integer division truncates towards zero, as it does in C, Java and SQL.

Runs in this browser. Nothing you paste is sent to a server.

Exact answers

Ordinary calculators and doubles are exact only up to 2^53; beyond that they round. 2^128 - 1, the size of the UUID or IPv6 space, has 39 digits and every one is shown here. Integer division truncates towards zero, as in C, Java and SQL, and the remainder takes the sign of the dividend.

In code

JavaScript's BigInt (with an n suffix), Python's built-in int, PHP's GMP or BCMath extensions and Java's BigInteger all do arbitrary-precision integer arithmetic. BigInt and Number cannot be mixed in one JavaScript expression without converting.

Share

Frequently asked questions

How big can the numbers be?
As large as memory and patience allow. Exponents are capped at 100,000 to keep the page responsive.
Does it handle decimals?
No, it is integer-only. Division drops the fractional part. Use the expression calculator for decimals.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools