Modulo gives the remainder left when one integer divides another.
What is a modulo calculator?
A modulo calculator finds the remainder when one integer divides another. For 17 mod 5 the remainder is 2 because 17 = 5 × 3 + 2. It also shows the quotient and checks that a equals b times quotient plus remainder. That matches clock arithmetic and hash-index math in programming. Remainders also appear when you wrap a 24-hour clock forward past midnight or split items into equal groups with a few left over.
How to use the Modulo Calculator
- Enter a as the dividend (the number being divided).
- Enter b as the divisor (must not be zero).
- Read a mod b in the main remainder result card.
- Note the quotient shown for the whole-number division part.
- Use the verification line to confirm a = b × q + r.
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.
Formula for modulo (remainder)
a = b × q + r
a mod b = r where 0 ≤ r < |b|- a is the dividend
- b is the divisor (non-zero)
- q is the quotient (integer part of a ÷ b)
- r is the remainder (a mod b)
Modulo example: 17 mod 5 and 100 mod 7
Find 17 mod 5. Divide: 17 ÷ 5 = 3 with remainder 2, so q = 3 and r = 2. Check: 5 × 3 + 2 = 17. The calculator displays remainder 2 and quotient 3.
Try 100 mod 7. 7 × 14 = 98, so the remainder is 100 − 98 = 2. Enter a = 100 and b = 7. You should see remainder 2 and quotient 14. For negative dividends the tool adjusts the remainder to stay from 0 up to |b| − 1, which is how mathematicians define mod on integers.
The same remainder appears in modular clocks: 15:00 plus 10 hours lands at 1:00 because hour arithmetic uses mod 12. Try 100 mod 7 next. Quotient 14 and remainder 2 because 7 times 14 is 98. For negative dividends, −17 mod 5 becomes 3 after adjusting the remainder into the range from 0 to 4. That matches how many languages define mod for hash tables even when division truncates toward zero. Divisibility tests use mod: a number is divisible by 3 when a mod 3 equals 0. Calendar problems that ask what weekday follows 100 days forward also reduce the count mod 7. Quotient times divisor plus remainder always reconstructs the original dividend a. Weekday problems: 365 days from Sunday lands on Sunday because 365 mod 7 equals 1, so only one weekday shift forward. Enter the same a and b here to confirm the remainder and quotient cards match your manual division.
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.
Related calculators
- Math Calculator
- Percentage Calculator
- Fraction Calculator
- Exponent Calculator
- Logarithm Calculator
- Nth Root Calculator
- Ratio Calculator
- Pythagorean Theorem
Maintained by J Jaya Prakash · Last updated: October 2026