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
- Choose a tab: “Arithmetic in any base”, “Modular power” or “Quotient and remainder”.
- 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.
- For a modular power, enter “Base a”, “Exponent b” and “Modulus n” in decimal.
- 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.
Related tools
Calculator
Standard, scientific and programmer calculator: exact decimal arithmetic, trigonometry in degrees or radians, and hexadecimal, octal and binary with bitwise operations.
Screen PPI calculator
Work out pixels per inch, dot pitch and aspect ratio from a screen’s resolution and diagonal size.
chmod calculator
Convert Unix file permissions between checkboxes, octal numbers such as 755 and symbols such as rwxr-xr-x, including setuid, setgid and sticky bits.
Byte radix and endianness converter
Convert bytes between hex, binary, octal, unsigned or signed decimal, Base64 and UTF-8 text, and swap byte order between big and little endian in 2, 4 or 8-byte words.
Character set encoding and mojibake repair
Show the bytes of text in UTF-8, GBK, GB18030, Big5, Shift_JIS and more as hex, turn hex back into text, or repair mojibake from text read in the wrong character set.
File to hex
Show any file as hex: a hexdump with offsets and an ASCII preview, plain hex, or a C byte array.