Free to use, no account

Modular Inverse Calculator

Find the number x that makes a × x leave a remainder of 1 when divided by m. See whether an inverse exists, the greatest common divisor, and the extended Euclidean steps.

Integer arithmetic only; supported absolute values are up to 1,000,000,000,000. A modular inverse exists only when the gcd is 1.

Definition: a × x ≡ 1 (mod m).

How do I find a modular inverse?

Enter an integer a and a modulus m of at least 2. An inverse exists exactly when gcd(a, m) = 1. The result is normalized from 0 to m − 1 and verified by multiplication modulo m.

Frequently asked questions

How do I find a modular inverse?

Enter an integer a and a modulus m of at least 2. An inverse exists exactly when gcd(a, m) = 1. The result is normalized from 0 to m − 1 and verified by multiplication modulo m.

Are my numbers sent to a server?

No. The arithmetic runs in your browser and the values are not uploaded or saved by this tool.

What is the inverse of 3 modulo 7?

It is 5 because 3 × 5 = 15, and 15 leaves remainder 1 when divided by 7.

When does a modular inverse exist?

An integer a has an inverse modulo m exactly when a and m are coprime, meaning their greatest common divisor is 1.

What if the input is negative?

The calculator first reduces a to its standard residue from 0 to m − 1. This does not change which inverse exists.