Modulo Calculator

Remainder—
Quotient—

How Modulo Calculator is calculated: remainder = dividend − (divisor × quotient), where quotient = dividend ÷ divisor rounded down

What is a modulo calculator?

A modulo calculator finds the remainder left over when one whole number is divided by another. Enter a dividend, the number being divided, and a divisor, the number you divide by, and it returns the remainder plus the quotient, the number of whole times the divisor fits in. This page gives you that answer in a second, with the working shown beside the result, and everything runs entirely in your browser with no sign-up and no data sent anywhere.

School students use modulo for division with remainders, and programmers use it every day, because the modulo operator, written % in most languages, is one of the most used operations in code. Students meet it in school maths, programmers meet it in code, and shopkeepers and clerks meet it whenever a total has to be split fairly or checked by hand.

The results box shows the answer first, in large type, and then the supporting numbers underneath it, so you can see both the headline and the working at a glance. Change any input and the answer updates at once, which makes it easy to test a few values and build a feel for how the numbers behave.

How the modulo operation works

The calculator divides the dividend by the divisor and keeps only the part that does not fit into whole groups. For 17 divided by 5, the divisor fits three whole times, which accounts for 15, and the 2 left over is the remainder. The quotient is 3 and the remainder is 2, and both are shown because each answers a different question about the same division.

The formula behind it is remainder = dividend minus (divisor times quotient), where the quotient is the dividend divided by the divisor and rounded down to a whole number. For the default example, 17 minus (5 times 3) is 17 minus 15, which is 2. That is the whole method: multiply, subtract, and what is left is the answer.

Two edge cases matter. Dividing by zero has no answer at all, so the calculator shows a dash instead of a number, which is the honest result. A remainder is always smaller than the divisor, so if you ever see a remainder of 5 when dividing by 5, something has gone wrong, because 5 would fit one more time.

A quick mental check is to multiply the quotient by the divisor and add the remainder: the total must equal the dividend. For the default example, 3 times 5 plus 2 is 17, which confirms the answer. This check takes seconds and catches almost every typing slip.

The divisor is the number people get wrong

The divisor is the input that causes most mistakes, because people swap the two numbers round. In 17 mod 5, the 17 is the dividend and the 5 is the divisor, and swapping them gives 5 mod 17, which is 5, a completely different answer. The order matters, so read the labels before typing.

The size of the divisor also sets the size of the answer: a remainder can never be as big as the divisor. Dividing 100 by 7 gives a remainder of 2 and a quotient of 14, since 14 times 7 is 98, and the remainder must sit between 0 and 6. If your divisor is large and your dividend is small, the remainder is simply the dividend itself.

The safe habit is to read the input back before trusting the output: check the digits, check the sign, and check that you have not swapped the two numbers round. A calculator only repeats the question you actually asked it, so a careful ten seconds on the input saves a wrong answer later.

A worked example: three divisions, three remainders

First, the default example on this page: 17 divided by 5. Five fits into 17 three times, which is 15, and 17 minus 15 leaves a remainder of 2, so the quotient is 3 and the remainder is 2. That is the number you get when you share 17 sweets among 5 children and keep what is left.

Second, 20 divided by 6. Six fits into 20 three times, which is 18, and 20 minus 18 leaves a remainder of 2, so the quotient is 3 and the remainder is 2 again. The same remainder can come from very different divisions, which is why the quotient is shown too.

Third, 100 divided by 7. Seven fits into 100 fourteen times, which is 98, and 100 minus 98 leaves a remainder of 2, so the quotient is 14 and the remainder is 2. Three different divisions, three remainders of 2, and three different quotients.

The pattern is that the remainder alone never tells the whole story: 2 could mean 17 divided by 5, 20 divided by 6, or 100 divided by 7. Always read the quotient with it, and the division is fully described.

Where remainders show up in real life

Clocks are the oldest modulo machine in daily life: 25 o'clock is 1 o'clock, because 25 mod 12 is 1, and the days of the week work the same way, with 10 days from a Monday landing on a Thursday. Calendars, timetables, and repeating rosters all run on remainders, whether or not anyone calls them that.

In computing, modulo decides whether a number is even, wraps an index round to the start of a list, and spreads data evenly across servers. A web page that colours alternate rows, a game that cycles through four players, and a hash table that places items in buckets all use the same operation. A GCD calculator and a LCM calculator sit next to this kind of work in most maths toolboxes, and people often use two or three of them together on the same problem.

In school, modulo is the remainder in long division, and it is also the test for divisibility: a number is divisible by another exactly when the remainder is zero. That single idea connects division, factors, and fractions, and it is worth learning properly rather than as a trick.

Try a few values yourself once you have read the worked examples, changing one input at a time and watching how the answer moves, then check one result by hand with the method above before you trust the screen. That habit, one hand check for every new kind of problem, is what turns a quick answer into real understanding, and it catches the typing slips that no calculator can catch for you.

Modulo calculator vs a normal division

A normal division gives you a decimal, like 17 divided by 5 equals 3.4, while modulo gives you the whole-number quotient and the remainder, 3 and 2. The decimal hides the remainder inside the .4, and modulo pulls it out into the open where you can use it. A prime number checker answers a different question, so the two tools complement each other rather than competing.

Use ordinary division when you need a share or a rate, like splitting a bill or working out a speed. Use modulo when you need whole groups and a leftover, like packing boxes, sharing items, or cycling through a repeating pattern. The question decides the tool, and most people need both at different times.

Modulo pairs naturally with the tools that answer the questions around it: whether a number divides evenly, what the largest common factor is, and what the smallest common multiple is. A percentage calculator is another tool people reach for on the same kind of problem, and keeping the three together covers most everyday cases.

Common modulo mistakes

The most common mistake is swapping the dividend and the divisor. 17 mod 5 is 2, but 5 mod 17 is 5, because 17 does not fit into 5 at all. Always put the bigger number first when you are dividing a larger pile into smaller groups, and read the labels on the two boxes.

The second mistake is forgetting that the remainder must be smaller than the divisor. If you divide by 7 and get a remainder of 9, the divisor fits one more time, so the real quotient is one higher and the remainder is 2. A remainder as big as the divisor is a sign the division is unfinished.

The third mistake is reading a decimal division as a remainder. 17 divided by 5 is 3.4, but the remainder is not 0.4, it is 2: the .4 is four-tenths of the divisor, and four-tenths of 5 is 2. Multiply the decimal part by the divisor to recover the remainder.

The fourth mistake is dividing by zero and expecting an answer. Zero groups of any size cannot make a pile, so modulo by zero is undefined, and any tool that returns a number for it is wrong. This calculator shows a dash, which is the correct and honest response.

How to use this modulo calculator

Type the dividend, the number being divided, in the first box, and the divisor in the second box, then read the remainder and the quotient below. The answer updates live as you type, so you can try a few values in seconds and watch how the remainder cycles as the dividend grows.

Read the two results together: the quotient tells you how many whole groups the divisor makes, and the remainder tells you what is left over. If the remainder is zero, the division is exact, and the dividend is a multiple of the divisor.

If an answer surprises you, check the input first, then run the worked example from this page through the calculator and confirm it gives the same result. When the known example is right and your own input is right, the answer is right, and that two-step check settles almost every disagreement between a person and a calculator.

Nothing you type leaves your device, so you can use the modulo calculator as often as you like, for homework, for work, or just to settle an argument. Bookmark the page and it is ready whenever the next number needs checking.

Frequently Asked Questions

Modulo is the remainder after division. 17 mod 5 is 2, because 5 goes into 17 three times (15) and 2 is left over. It answers the question of what remains after you have taken out as many whole groups as possible.

17 mod 5 is 2. Five goes into 17 three times, which is 15, and 17 minus 15 leaves 2. The quotient is 3 and the remainder is 2, and this calculator shows both numbers.

Modulo by zero has no answer, because division by zero is undefined in maths. This calculator shows a dash instead of a number when the divisor is zero, rather than inventing a result.

Programmers use it constantly: to test if a number is even (n mod 2 equals 0), to wrap values around a clock or a list, and in hashing. Clocks use it too, since 25 o'clock is 1 o'clock, which is 25 mod 12.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.