Free online tools

Modular Arithmetic Calculator

Enter an integer and a positive modulus. Compute a basic modular operation without losing digits.

Enter your values

Ignored in a modulo m mode.

This tool processes your input in your browser.

Result

Use the least nonnegative residue

The result is between zero and m minus one. Negative values wrap around this interval, so −17 modulo 5 is 3.

Reduce during the arithmetic

Sums and products can use reduced operands. A modular power repeatedly squares and reduces intermediate values, keeping exact integers even when the unreduced power is large.

Frequently asked questions

Can the modulus be one?

Yes. Every integer has residue zero modulo one.

Can a power use a negative exponent?

This form accepts nonnegative exponents. A negative power would require an appropriate modular inverse.