Calculate modulus operations instantly. Find the remainder when dividing one number by another. Easy-to-use mod calculator with step-by-step explanation.
Results are estimates. Not professional advice.
A modulo calculator (also known as a mod calculator or modulus calculator) calculates the remainder when one number (the dividend) is divided by another number (the divisor). The modulo operation is denoted as "a mod b" or "a % b" and returns the remainder of the division.
The modulo operation (mod) finds the remainder after division. For example:
The modulo operation can be expressed as:
a mod b = remainder when a is divided by b
Or mathematically:
a mod b = a - (b × floor(a/b))
Where floor(a/b) is the integer division (quotient) of a by b.
The modulo operation (mod) finds the remainder after dividing one number by another. For example, 29 mod 5 = 4 because 29 divided by 5 equals 5 with a remainder of 4.
To calculate a mod b, divide a by b and find the remainder. For example, 17 mod 3 = 2 because 17 ÷ 3 = 5 remainder 2. The modulo result is always between 0 and (b-1) when b is positive.
When a mod b = 0, it means that a is divisible by b with no remainder. For example, 20 mod 4 = 0 means 20 is divisible by 4.
Division gives you the quotient (how many times one number fits into another), while modulo gives you the remainder (what's left after division). For example, 29 ÷ 5 = 5.8 (quotient), while 29 mod 5 = 4 (remainder).
Modulo is commonly used in programming for checking even/odd numbers (n mod 2), array indexing with wraparound, hash functions, generating random numbers, and implementing cyclic patterns or clocks.
The behavior of modulo with negative numbers depends on the implementation. In most programming languages and mathematical conventions, the result is always non-negative when the divisor is positive. For example, -5 mod 3 = 1 (not -2).