Modular Arithmetic Calculator

Calculate Euclidean remainders, modular powers or multiplicative inverses using bounded exact integer arithmetic.

On-device No sign-up Free to use

Calculate modular result controls

Showing an example. Edit to see your own.

?

A whole number, negative allowed, up to 1,000 digits.

?

A whole number of 0 or more, up to 1,000,000.

?

A whole number greater than 1.

Processed in your browser. Your inputs stay on this device.

Result

Showing an example.

Find a Euclidean remainder.

17 mod 5 = 2.

https://usefreetools.net/modular-arithmetic-calculator · 20 November 2026

Was this helpful?

How to use Modular Arithmetic Calculator

  1. Choose Remainder, Power or Inverse, then enter integer a and an integer modulus greater than 1. Negative a is allowed.
  2. For Power, enter a whole exponent from 0 to 1,000,000. The exponent field is ignored by the other operations.
  3. Calculate and read the result from 0 to m − 1. For an inverse, the output also checks that a × result mod m = 1; shared factors produce an explanation instead.

Example: Modular Arithmetic Calculator

Find a Euclidean remainder.

You add
Operation: Remainder (a mod m) Value (a): 17 Exponent (power only): 5 Modulus (m): 5
You get
17 mod 5 = 2.

Supported inputs and limits

  • Value a and modulus m accept signed integer text with up to 1,000 digits, without commas, decimal points or exponent notation.
  • The modulus must exceed 1.
  • Power accepts only whole exponents from 0 to 1,000,000; negative powers are unsupported.
  • The result uses exact BigInt arithmetic within these bounds.
  • An inverse exists only when a and m are coprime.
More details

This is not a cryptographic key generator or a constant-time implementation.

Where your input is processed

This tool does not upload your inputs. See the limits for anything saved on your device.

An inverse undoes multiplication modulo the chosen modulus

An inverse b satisfies a × b congruent to 1 modulo m. It is a property of the integer together with its modulus, so changing the modulus can change the result or remove the inverse.

Questions about Modular Arithmetic Calculator

What happens to a negative integer?

The Euclidean remainder stays between zero and modulus minus one. For example, -1 modulo 5 is 4.

Why can an inverse be unavailable?

An integer has a multiplicative inverse modulo m only when its greatest common divisor with m is one.

Does exponent zero give one?

Yes, reduced modulo the accepted modulus. The tool uses the standard modular exponentiation convention.

Page updated · Project managed by Tony Hines · Report a problem with Modular Arithmetic Calculator