Modulo gives the remainder left when one integer divides another.
About this calculator
Modulo gives the remainder left when one integer divides another. Seventeen mod five is two because 17 = 5 × 3 + 2. Programmers use the same idea for hash buckets, clock arithmetic, and cyclic patterns.
This calculator also shows the quotient and verifies a = b × q + r. Negative dividends are handled so the remainder stays in the expected range.
Modulo underpins cryptography and scheduling logic. For full long division steps see the [[long-division]] calculator. For multiples of a number try the [[multiples]] calculator. For exponent patterns use the [[exponent]] calculator.
Common uses
- Find remainders for number theory homework
- Check clock arithmetic (hours mod 12)
- Verify hash index calculations in code
- Explore divisibility without a spreadsheet
Frequently asked questions
What is 17 mod 5?
2. Because 17 ÷ 5 = 3 remainder 2, and 17 = 5 × 3 + 2.
What is −17 mod 5?
3 in the standard convention. The remainder is adjusted to be non-negative: −17 = 5 × (−4) + 3.
Is modulo the same as remainder in division?
For positive integers, yes. Some programming languages use truncated division for negatives; this calculator uses the mathematical non-negative remainder.
What happens when b is zero?
Division by zero is undefined. Enter a non-zero divisor.