YourTools.
简体中文
Back to the catalog
Tools

Big number calculator

Add, subtract, multiply and divide integers of any size in binary, octal, decimal or hex, compute a^b mod n, and divide repeatedly until the quotient is 0.

Loading…

Runs in this page in your browser; nothing is uploaded.

About this tool

Calculate exactly with integers of any length. Use it to add or multiply 64-bit hex values, to check a modular exponentiation in RSA or Diffie–Hellman homework, or to convert a number to another base by repeated division.

“Arithmetic in any base” adds, subtracts, multiplies and divides in binary, octal, decimal or hex and shows the result in all four bases. “Modular power” computes a^b mod n, and “Quotient and remainder” divides repeatedly until the quotient is 0, with a CSV download. Results update as you type, in your browser, and nothing is uploaded.

How to use it

  1. Choose a tab: “Arithmetic in any base”, “Modular power” or “Quotient and remainder”.
  2. For arithmetic, pick the “Base”, enter A and B, and choose the “Operation”. The result appears in binary, octal, decimal and hex, each with a “Copy” button.
  3. For a modular power, enter “Base a”, “Exponent b” and “Modulus n” in decimal.
  4. For quotient and remainder, enter the “Dividend” and “Divisor”, keep “Keep dividing until the quotient is 0” ticked to divide repeatedly, and select “Download CSV” to save the table.

Common questions

How is division with negative numbers handled?

Division drops the fractional part, rounding toward zero, and the remainder takes the sign of the dividend. For example, -7 ÷ 2 gives -3 remainder -1.

What number formats can I type?

Digits of the chosen base with an optional + or - sign and an optional 0x, 0o or 0b prefix that matches the base. Spaces, underscores and commas between digit groups are ignored, and hex letters can be upper or lower case.

How are negative results shown in binary and hex?

As a minus sign followed by the digits, not as a two’s complement bit pattern. For a fixed-width bit pattern, use the programmer mode of Calculator.

Can the modular power take a negative base?

Yes. The exponent must be 0 or more and the modulus greater than 0, and the result is always between 0 and n − 1. It uses fast exponentiation, so a^b is never computed in full, even for very large exponents.

How do I read a base conversion from the remainder table?

Read the remainders from the last row up. Dividing 255 by 16 gives remainders 15 and 15, which is FF in hex; remainders are always written in decimal and separated by spaces. The chain stops when the quotient reaches 0, or after 10,000 rows.