Modulo Calculator - Remainder of Division

Calculate the remainder of any division operation (X mod Y). Supports negative numbers and shows step-by-step work.

Runs in your browser. No data leaves your device.

Frequently Asked Questions

How does the Modulo Calculator work?

The tool applies JavaScript's remainder operator (%) to compute X mod Y. It also shows the step-by-step division: quotient = Math.trunc(X / Y), then remainder = X - quotient * Y. For negative dividends, the result keeps the sign of the dividend, matching the behavior of most programming languages.

What does modulo mean?

Modulo (or mod) gives the remainder after dividing one number by another. For example, 10 mod 3 = 1, because 10 divided by 3 is 3 with a remainder of 1.

How does modulo work with negative numbers?

The tool shows the result using JavaScript's remainder operator. For negative numbers, -7 mod 3 = -1. The sign of the result matches the sign of the dividend (the first number).

What is modulo used for in programming?

Common uses include checking if a number is even or odd (n % 2), cycling through array indices, implementing circular buffers, time calculations (e.g., converting seconds to minutes), and hash table indexing.