Modulo Calculator - Remainder of a mod b
A free online modulo calculator that computes a mod b, the remainder left after dividing a by b. Enter a dividend and a non-zero divisor to get the result instantly.
Enter a value for a and a non-zero value for b.
How it works
What is the modulo operation?
The modulo operation, written a mod b, returns the remainder after dividing a by b. For example, 17 mod 5 equals 2, because 17 divided by 5 is 3 with 2 left over.
The divisor b must not be zero, since division by zero is undefined.
Where modulo is used
Modulo is everywhere in math and programming: checking even or odd numbers, wrapping array indices, building hash tables, and clock arithmetic.
It is also the foundation of modular arithmetic used in cryptography and number theory.
Frequently asked questions
โบWhat does a mod b mean?
It is the remainder left after dividing a by b. For example, 17 mod 5 equals 2.
โบWhy can't b be zero?
Division by zero is undefined in mathematics, so the divisor b must be a non-zero number.
โบHow is modulo of negative numbers handled?
Results follow standard math conventions; the sign of the remainder may differ from some programming languages.
โบIs the result always smaller than b?
For positive operands, the remainder is always between 0 and b minus 1.
โบWhat is modulo used for in programming?
Common uses include checking even or odd numbers, cycling through indices, and hashing.
Related tools
Last updated: