Modulo Calculator

A modulo calculator for arithmetic that stays inside a fixed modulus. Enter two numbers and a modulus to add, subtract, multiply or raise to a power with the answer reduced to the range 0 to n minus 1, solve a x = b (mod n) to get every solution and the modular inverse of a, or enter a single number to see its remainder under both sign conventions. Negative operands are accepted throughout, and the two answers they produce are shown side by side rather than picked for you. Powers are worked by repeated squaring, so a large exponent costs nothing.

Calculator Type

Adds, subtracts, multiplies or raises to a power, and reports the answer as the smallest whole number from 0 upwards that is congruent to it.

For a power this is the exponent and it cannot be negative. A negative exponent is a modular inverse, which the other tab does.
Widget

Finds every x that satisfies the congruence. With b set to 1 this is the modular inverse of a.

Leave this at 1 to get the modular inverse of a.
Widget

The other unknown. You know the number and the remainder it leaves, and you want every modulus that would produce that remainder.

The answer a mod n comes out to. A remainder is always smaller than the modulus, and here it also has to be smaller than a.
Widget

The plain remainder, with the two answers a negative operand can produce set side by side.

A negative modulus is allowed here, so the effect on the sign of the answer is visible.
Widget