Modulo Calculator

Calculate a modulo remainder and integer quotient for positive or negative numbers.

Modulo and remainder calculator
Enter a dividend and a nonzero divisor to evaluate a mod b.

About the modulo calculator

Modulo arithmetic describes what remains after one number is divided by another. In the expression a mod b, a is the dividend and b is the modulus or divisor. The result is the remainder associated with division by b. For example, 17 divided by 5 has an integer quotient of 3 and leaves 2, so 17 mod 5 equals 2. This simple operation appears throughout elementary arithmetic, number theory, computer science, cryptography, scheduling, and data structures. This modulo calculator reports both the Euclidean remainder and the corresponding quotient. It chooses a remainder from zero up to, but not including, the absolute value of the divisor. That convention keeps the answer predictable for negative dividends. For example, negative 13 mod 5 is 2 because negative 13 equals 5 times negative 3 plus 2. Some programming languages use a remainder operator that preserves the sign of the dividend instead, so their result for the same inputs may be negative 3. Knowing which convention is in use matters when translating a mathematical formula into code. Modulo is especially useful for repeating cycles. Clock arithmetic is a familiar example: adding five hours to 10 o'clock gives 15, and 15 mod 12 gives 3 o'clock. Weekday calculations use modulus 7, circular array indexes use the array length, and parity checks use modulus 2. In programming, a zero remainder can test divisibility, distribute records among buckets, wrap positions around a collection, or select every nth item. In number theory, congruence says two integers are equivalent modulo b when they have the same remainder after division by b. The divisor cannot be zero because division by zero has no defined quotient or remainder. Decimal inputs are accepted for convenient remainder calculations, although modular arithmetic in proofs and cryptographic algorithms normally uses integers. When a problem asks for an integer congruence, enter whole numbers and interpret the displayed nonnegative remainder as the canonical representative of its congruence class. The calculator performs the operation immediately and shows the division identity, making it easy to verify the result without doing repeated subtraction by hand.

Modulo calculation examples

These examples show common remainder, divisibility, and cycle calculations.

OperationResultExplanation
17 mod 52Five fits into 17 three times, leaving a remainder of 2.
48 mod 60A zero remainder confirms that 48 is divisible by 6.
29 mod 125This is the same wraparound used for a 12-hour clock.
-13 mod 52The Euclidean convention returns the nonnegative remainder 2.

How to calculate a modulo

  1. Enter the number being divided in the Dividend field.
  2. Enter a nonzero modulus in the Divisor field.
  3. Select Calculate modulo to compute the remainder and quotient.
  4. Check the displayed division identity or select Reset to start again.

Modulo calculator FAQ

What is the difference between modulo and remainder?

They describe closely related division results, but sign conventions can differ for negative values. This calculator uses the Euclidean convention and always returns a remainder from zero up to the absolute divisor.

Can the divisor in a modulo operation be zero?

No, modulo zero is undefined because division by zero has no meaningful quotient. Enter any positive or negative nonzero divisor instead.

How does modulo work with a negative dividend?

The calculator adjusts the raw remainder into a nonnegative Euclidean remainder. For example, negative 13 mod 5 is 2 because negative 13 equals 5 times negative 3 plus 2.

How can modulo test whether one number divides another?

Calculate the first number modulo the proposed divisor. A result of zero means the divisor divides the number evenly, while any other result is the amount left over.

Where is modular arithmetic used?

It is used for clocks, calendars, cyclic indexes, hashing, checksums, and cryptographic algorithms. The operation converts an unrestricted value into a predictable repeating range.