Modulo Calculator
Divide one number by another and keep just the remainder.
a mod b
2
17 mod 5 = 2
How this differs from division
Regular division of 17 by 5 gives a quotient of 3 with what's left over as the remainder. Modulo throws away the quotient and keeps only that leftover: 17 = 3 × 5 + 2.
How it works
The modulo operation, written a mod b, hands back whatever is left over after you divide a by b as many whole times as you can. 17 mod 5 is 2, because 5 goes into 17 three full times (15) and leaves 2 behind.
Division and modulo are two halves of the same story. Dividing gives you the quotient — how many times b fits — while modulo gives you the leftover. Put them together and you always get back a = quotient × b + remainder.
Type your two numbers and the answer updates as you go. If the divisor is zero you'll see a dash, because there's no sensible remainder when you can't divide.
Frequently asked questions
How is modulo different from division?
Division tells you how many whole times one number fits into another; modulo tells you what's left over once it can't fit any more times. 17 ÷ 5 is 3 with a remainder of 2, so 17 mod 5 is exactly that remainder, 2.
What happens with negative numbers?
This calculator follows the common convention where the remainder takes the sign of the dividend, the same as most programming languages. So -17 mod 5 comes out as -2 rather than 3. Keep that in mind if you're comparing with a textbook that defines it differently.
Why can't the divisor be zero?
A remainder only makes sense when you can actually divide, and dividing by zero is undefined. Enter a divisor of zero and you'll get a dash instead of a made-up answer.