Modulo Calculator

Quotient
-
Remainder (a mod n)
-
Verification
-
Floored Mod
-

About Modulo Calculator

What Is Modulo?

The modulo operation (mod) finds the remainder when one integer is divided by another. For example, 17 mod 5 = 2 because 17 divided by 5 equals 3 with a remainder of 2 (5 x 3 + 2 = 17). Written as a mod n = r, where a is the dividend, n is the divisor (modulus), and r is the remainder. Modulo is fundamental in computer science, cryptography, clock arithmetic, and number theory.

Applications of Modulo

Clock arithmetic: Hours work mod 12 or mod 24. Even/odd check: n mod 2 = 0 means even. Cryptography: RSA encryption relies on modular exponentiation. Hash functions: Distribute data across buckets using mod. Cycling through arrays: index mod length wraps around. Day of week: Days work mod 7.

How to Use This Calculator

Enter the dividend (number being divided) and the divisor (modulus). The calculator shows the quotient, remainder (modulo result), and a step-by-step breakdown. It handles negative numbers and large values correctly, showing both the truncated and floored division conventions.

Frequently Asked Questions

How does modulo work with negative numbers?

Different languages handle this differently. In mathematics, the result is always non-negative. In C/Java, the result has the same sign as the dividend. In Python, it has the same sign as the divisor. This calculator shows both conventions.

What is modulo 0?

Division by zero is undefined, so modulo 0 is undefined. Any number mod 0 has no valid result and will produce an error.

Is modulo the same as remainder?

For positive numbers, yes. For negative numbers, they can differ depending on the convention used (truncated vs floored division). In everyday use and with positive values, modulo and remainder are the same.