Math calculator

Modulo Calculator

Return the standard nonnegative remainder after integer division. Input changes update both remainder and the supporting steps.

Modulo inputs

Complete the fields

When the result is useful

Clock arithmetic, repeating schedules, array indexing, checksums, and divisibility patterns all use remainders. Modulo turns an unlimited integer line into a repeating cycle of residue classes. A related application of Modulo is integer factors.

Reading the calculation

Modulo arithmetic groups integers by their remainders after division by a positive modulus. Two integers are congruent modulo n when their difference is divisible by n. For a connected concept in Modulo, see divisibility structure.

A correct remainder therefore depends on choosing the model before entering the numbers.

A worked example

−17 mod 5 is 3 under the nonnegative convention because −17 = (−4) × 5 + 3. The remainder lies in the required range 0 through 4.

A paper-and-pencil route

Find integers q and r satisfying a = qn + r with 0 ≤ r < n. For a negative dividend, choose the floor-style quotient that leaves a nonnegative remainder.

Details that change the outcome

Programming languages differ in how the % operator handles negative dividends. Some return a signed remainder such as −2; this page normalizes the result to the usual mathematical range 0 ≤ r < n.

When modulo looks surprising, restore the sample and vary dividend by itself.

Checking the model and magnitude

For this modulo calculation, the labels dividend and positive modulus carry mathematical meaning. A transposed entry can remain numerically valid while describing an entirely different setup.

Adding or subtracting any whole multiple of the modulus leaves the residue unchanged. Consecutive integers cycle through the allowed remainders and then return to zero. A small controlled input change is enough to test the expected direction.

Modulo returns a residue class representative, whereas ordinary division returns a quotient and may show a fractional part. Both originate from division but answer different questions. Checking the requested noun is often enough to select the right model.

An exact expression can preserve factors, radicals, or π that a decimal hides. Use the representation suited to the next task and label it clearly as remainder.

Reproducibility here depends on the inputs more than the interface. Preserve dividend and positive modulus, the operation shown, and enough unrounded digits for the next calculation.

Residues and repeating classes

The quotient is not displayed because many different quotients can accompany congruent integers while the residue remains the same. For modulus 5, values such as 3, 8, −2, and 103 all occupy the residue class represented by 3.

Modular addition and multiplication can reduce operands before the operation. Replacing large integers by their residues keeps the arithmetic small and does not change the final residue, a property frequently used in divisibility checks and repeating-cycle problems.

Questions people ask

Is modulo the same as remainder?

For positive inputs they usually coincide; negative-input conventions can differ.

Why require a positive modulus?

It gives a clear standard residue range from 0 through n − 1.

What is a mod 1?

Always 0, because every integer is divisible by 1.

Can modulo test evenness?

Yes. An integer is even exactly when n mod 2 equals 0.