Remainder Calculator (Modulo)
Calculate the remainder when dividing two numbers (modulo operation). See also Long Division Calculator and GCF Calculator.
How to Calculate Remainder
The remainder is what is left over after dividing one number by another. Divide the dividend by the divisor to get the integer quotient, then multiply the quotient by the divisor and subtract from the dividend. The modulo operation (mod) returns this remainder. It is widely used in programming, cryptography, and number theory.
Remainder Formula
A mod B = R
where: A = B × Q + R
Q = floor(A / B) (integer quotient)
R = A − B × Q (remainder)
0 ≤ R < |B|
Example
Calculate: 17 mod 5
Quotient: floor(17 / 5) = floor(3.4) = 3
Remainder: 17 − 5 × 3 = 17 − 15 = 2
Verification: 17 = 5 × 3 + 2 ✓
Frequently Asked Questions
What is the modulo operation?
The modulo operation finds the remainder after division. In programming, it is often written as A % B. For example, 17 % 5 = 2 because 17 divided by 5 is 3 with a remainder of 2.
Can the remainder be negative?
In mathematics, the remainder is typically non-negative. However, some programming languages define modulo differently for negative numbers. This calculator uses the mathematical definition where the remainder is always non-negative.
What is the remainder when dividing by 1?
Any integer divided by 1 has a remainder of 0, since every integer is divisible by 1. For non-integers, the remainder equals the fractional part.
How is modulo used in real life?
Modulo is used in clock arithmetic (12-hour time), determining even/odd numbers, hash functions, cryptography, and cyclic patterns like days of the week.