Modulo Calculator
Enter a dividend and divisor to find the quotient and remainder (modulo).
How modulo is calculated
The modulo operation finds the remainder after dividing one number by another. This calculator uses floored division (a − b × floor(a/b)), which always returns a remainder with the same sign as the divisor — the convention used in mathematics and most programming languages like Python and Ruby.
For positive numbers, this matches the simple remainder you'd get from long division. The floored convention mainly differs from a "truncated" convention (used in some languages like C and Java) when either the dividend or divisor is negative.
Frequently asked questions
What's the difference between modulo and remainder?
For positive numbers, they're identical. They can differ for negative numbers depending on the rounding convention used — floored division (used here) always gives a result with the same sign as the divisor, while truncated division gives a result with the same sign as the dividend.
What is modulo used for?
Modulo is common in programming for cycling through a fixed range of values (like array indices or clock hours), checking divisibility (a number is even if a mod 2 equals 0), and various cryptographic and hashing algorithms.
Why does my programming language give a different answer for negative numbers?
Different languages use different modulo conventions. Python and Ruby use floored division like this calculator, while C, Java, and JavaScript's % operator use truncated division, which can produce a negative remainder when the dividend is negative.