Modulo Calculator

Inputs stay on your device Method shown below Free to use

Modulo Calculator

a mod b is the remainder after dividing a by b. This calculator reports a non-negative remainder.

Your result will appear here. Enter values and calculate.

Enter dividend and divisor

Enter the dividend and divisor. The calculator returns the remainder after division according to its stated rule. For positive whole numbers, modulo works like the ordinary remainder from division.

Use this page for remainders, clock arithmetic, cycles, programming examples and wraparound patterns. Be careful with negative numbers because programming languages do not all use the same convention.

What the remainder means

For positive numbers, a mod b is what remains after b fits into a as many whole times as possible. For example, 17 mod 5 is 2 because 5 fits into 17 three times, using 15, with 2 left over.

In modular arithmetic, numbers that differ by a multiple of the divisor are treated as equivalent. That is why modulo is useful for clocks and repeating cycles.

The result tells you position inside a cycle, not only leftover arithmetic. That is why programmers use it for indexes and wraparound behavior.

Modulo rule used here

For positive values, divide the dividend by the divisor, keep the whole number quotient, multiply the quotient by the divisor and subtract from the dividend. The remainder is the modulo result.

With negative values, the result depends on whether the rule uses floor division, truncated division or a non negative remainder convention. The page should state which rule it follows.

17 mod 5

For 29 mod 9, 9 fits into 29 three times. Three times 9 is 27. Subtract 27 from 29 to get 2. So 29 mod 9 equals 2.

For clock time, 14 hours after 10 o clock lands at 24, which wraps to 0 on a 12 hour cycle. The modulo idea handles the wraparound.

Negative remainders across systems

The biggest mistake is assuming modulo with negative numbers has one universal programming result. Python, JavaScript and C style languages may differ.

Another mistake is confusing quotient and remainder. Modulo returns the leftover part, not how many times the divisor fit into the dividend.

Also check that the divisor is not zero. Division by zero is undefined, so modulo by zero is not a valid operation.

Modulo Calculator FAQ

What does modulo mean?

Modulo gives the remainder after division. For 17 mod 5, divide 17 by 5. The whole quotient is 3, which accounts for 15. The remainder is 2.

So 17 mod 5 equals 2.

A good way to think about it is leftover position. After full groups of 5 are removed from 17, the modulo result tells what is still outside those full groups.

Why is modulo useful?

Modulo is useful for cycles. Clocks, repeating schedules, odd or even checks and programming wraparound logic all use the same idea.

If something repeats every 7 steps, modulo 7 tells where you are inside that cycle.

Why do negative modulo results differ?

Negative modulo depends on the division convention. Some systems keep the remainder non negative. Some keep the sign tied to the dividend. Some use floor division.

This is why the same expression can produce different results in different programming languages.

If you are matching code, use the rule from that language. If you are doing math class work, use the convention your course states.

Is modulo the same as remainder?

For positive whole numbers, modulo and remainder usually match. With negative numbers, the distinction can matter.

If your task involves programming, check the language rule instead of assuming every calculator will match it.

For ordinary arithmetic practice with positive inputs, you can usually read modulo as remainder. For code, the exact convention matters more.

Can the modulo result be bigger than the divisor?

For ordinary positive modulo, the result is smaller than the divisor and at least zero. For example, mod 5 results are 0, 1, 2, 3 or 4.

If you see a larger result, check the input, divisor or the convention being used.

How can I check a modulo result?

Multiply the divisor by the whole number quotient, then add the remainder. The result should return the original dividend.

For 29 mod 9, the quotient is 3 and the remainder is 2. 9 x 3 + 2 equals 29, so the result checks out.