Maths & numbers

Modular inverse calculator

Find the multiplicative inverse modulo an integer using Bézout coefficients.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Verify the result by multiplying it by the input and reducing the product modulo the chosen modulus.

THE FORMULAax ≡ 1 (mod m)

A worked example

7 × 15 = 105, which leaves remainder 1 modulo 26.

Good to know

An inverse exists exactly when the input and modulus are coprime.

Check the inverse by multiplying and taking a remainder

For integer 7 and modulus 26, the calculator returns 15. Their product is 105, and 105 = 4 × 26 + 1. The remainder is one, so 7 × 15 ≡ 1 modulo 26. This means multiplying a residue by 15 reverses multiplication by 7 in arithmetic modulo 26.

The extended Euclidean algorithm produces the identity 7 × 15 + 26 × (−4) = 1. Reducing the identity modulo 26 removes the second term and leaves the inverse relationship. The Bézout coefficients calculator can expose this integer-combination reasoning.

Seven times fifteen is four complete groups of twenty-six plus one2626262617 × 15 = 105105 = 4 × 26 + 1
The remainder of 105 divided by 26 is 1, verifying that 15 is an inverse of 7 modulo 26.

Check existence before trying to divide residues

An inverse exists exactly when the integer and modulus have gcd one. For integer 4 and modulus 12, every product 4x is divisible by 4, so its remainder cannot be 1 modulo 12. The calculator reports No inverse. Ordinary real-number division does not bypass this modular obstruction.

All integers congruent to an inverse represent the same residue. In the default case, 15, 41 and −11 are equivalent modulo 26. The displayed result uses the least nonnegative representative, between 0 and 25. Use the Coprime number check calculator to test existence first. An input of zero has no inverse for any allowed modulus.

A few questions, answered

Does the integer have to be less than the modulus?

No. An integer and its remainder modulo the modulus have the same inverse whenever an inverse exists.

Is the inverse the ordinary reciprocal?

It is an integer residue whose product leaves remainder one. For 7 modulo 26 the inverse is 15, rather than the real number 1/7.

Find your calculator

Start typing to explore the library.