Modulo Calculator (remainder)

Find the remainder and quotient of a division (a mod b).

Result

Remainder (a mod b)

2.0000

Quotient

3

How it works

a = quotient × b + remainder

The modulo operation returns what is left after a division. Euclidean division writes a = quotient × b + remainder, with the remainder between 0 and b−1: for 17 mod 5, since 17 = 3×5 + 2, the quotient is 3 and the remainder 2. Modulo powers anything that cycles. Hours wrap modulo 12 or 24 — 10 o'clock plus 5 hours is (10+5) mod 12 = 3 o'clock. Days of the week cycle modulo 7, and a remainder of 0 is precisely what "divisible" means, which gives instant divisibility tests. In programming it is everywhere: n mod 2 distinguishes even from odd, mod distributes items into a fixed number of buckets (hashing), and mod k makes any counter loop back to 0 after k steps. Note that languages differ on negative numbers — some return −3 mod 5 as 2, others as −3.

Advertisement

Frequently asked questions

What is 17 mod 5?

2 — because 17 = 3×5 + 2.

What if the divisor is 0?

Division by zero is undefined, so the result is shown as 0.

What are everyday uses of modulo?

Anything cyclic: clock arithmetic (hours mod 12), weekday calculations (mod 7), even/odd checks (mod 2), divisibility tests (remainder 0), and spreading items evenly into groups.

Advertisement

Related calculators