Modulo Calculator

The remainder of a division, both conventions.

Math Calculators Free, no sign-up Runs in your browser

Modulo Calculator tool

The number being divided.

The number you divide by.

—
a mod n
—
Quotient
—
Remainder, truncated
—
Remainder, floored
—
Divides exactly?
MeasureValue
The two conventions differ only for negative numbers. -17 mod 5 is 3 under the floored convention used in Python and in mathematics, and -2 under the truncated convention used by C, Java and JavaScript. Both are shown, because which one you want depends on the language you are writing in.

About the Modulo Calculator

Modulo Calculator gives the remainder left when one number is divided by another, along with the quotient. It is the operation behind clock arithmetic, checksums, hash buckets, cycling through a list and every 'every nth item' rule: 17 mod 5 is 2 because five goes into seventeen three times with two left over.

Negative numbers are where the operation stops being obvious, and the calculator shows both answers rather than picking one. Mathematics and Python floor the quotient, which keeps the remainder's sign the same as the divisor: -17 mod 5 is 3. C, Java, JavaScript and most spreadsheet engines truncate towards zero, which keeps the remainder's sign the same as the dividend: -17 % 5 is -2. Neither is wrong, but mixing them up produces bugs that only appear on negative input.

The modular inverse is listed when one exists. It is the number that multiplies a back to 1 modulo n, and it exists only when a and n share no common factor. That condition is the whole basis of RSA and of most modular arithmetic in cryptography, which is why it is worth seeing beside the remainder.

The page shows its working, not just its answer. Where there is a formula it is printed with your own numbers substituted in, so you can check the result rather than take it on trust -- which is the difference between a calculator you can use for something that matters and one you cannot.

Everything runs inside your browser. What you type is never uploaded, never logged and never stored, and the calculator keeps working if your connection drops after the page has loaded.

Looking for something this does not cover? FreeToolsHub.org is another hub of free online tools that need no account, and it is worth a look if modulo calculator is only part of what you are working on.

How to use the Modulo Calculator

  1. Enter dividend (a) and divisor (n)Decimals are fine, and thousands separators are accepted and ignored.
  2. Read the a mod n, quotient and remainder, truncatedThe figures update as you type. The Calculate button is there if you would rather press something, but nothing waits for it.
  3. Copy or check the resultCopy the summary with the copy button, or open the table to check it row by row and read the formula with your own numbers in it.

Features

  • Shows a mod n, quotient, remainder, truncated, remainder, floored and divides exactly? together, so you are not running it twice
  • A results table you can read across
  • Prints the formula with your own figures substituted in
  • Updates as you type, with no button to press and no page reload
  • Copy the result in one click
  • Free, no sign-up, and it runs entirely in your browser

Who uses this tool

The modulo calculator is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:

  • Finding the remainder of a division
  • Checking whether one number divides another exactly
  • Working out a clock or cyclic position
  • Comparing how two languages handle a negative modulo

Frequently asked questions

What does mod mean?

The remainder after division. 17 mod 5 is 2, because 17 is three fives with two left over.

Why are there two different remainders?

They differ only for negative numbers. Flooring keeps the sign of the divisor, truncating keeps the sign of the dividend. Python floors; C, Java and JavaScript truncate.

How do I test whether a number is even?

Take it mod 2. A remainder of 0 means even, 1 means odd.

What is a modular inverse?

The number that multiplies a back to 1 modulo n. It exists only when a and n are coprime, and it underpins RSA and similar schemes.

If the modulo calculator is not quite what you need, these other free tools solve closely related problems, and there are 25 more in math calculators.

Fraction Calculator

Calculate with fractions and mixed numbers, simplified and explained.

Math Calculators Use tool

Prime Number Checker

Check whether a number is prime and find its factors.

Math Calculators Use tool

Proportion Calculator

Cross-multiply to find the missing term of a proportion.

Math Calculators Use tool

Checked and rebuilt on 2026-10-14. The method this calculator uses is described in the section above, and corrections go through the contact page.