Math
Instant, private, and free
Inverse Modulo Calculator.
Find a⁻¹ modulo m when a and m are coprime.
Set your values
Results update as you type.
Results update automatically as you type.
Use Cases
Solving linear congruences
Use the inverse to solve equations of the form a*x ≡ b (mod m) by multiplying both sides by the inverse of a modulo m.
Example: Solve 3x ≡ 4 (mod 7): inverse of 3 mod 7 is 5, so x ≡ 20 ≡ 6 (mod 7).
Cryptography and modular arithmetic
In RSA and other cryptographic systems, modular inverses are used for key generation and decryption. This calculator helps compute the private exponent.
Example: In RSA, compute d = e^{-1} mod φ(n) using the extended Euclidean algorithm.
Frequently Asked Questions
- What is a modular multiplicative inverse?
- A modular multiplicative inverse of a modulo m is an integer x such that (a * x) mod m = 1. It exists only if a and m are coprime (gcd(a, m) = 1). The inverse is unique modulo m.
- How does the extended Euclidean algorithm find the inverse?
- The extended Euclidean algorithm computes gcd(a, m) and also finds integers x and y such that a*x + m*y = gcd(a, m). If gcd is 1, then x is the inverse of a modulo m. The calculator returns x mod m (in the range 0 to m-1).
- What if the inverse does not exist?
- If a and m are not coprime (gcd > 1), then no modular inverse exists. The calculator will indicate that no solution is found. In such cases, you cannot solve equations like a*x ≡ 1 (mod m).
Tips & Common Mistakes
Tips
- Ensure that the modulus m is a positive integer. The calculator expects m > 0.
- The value a can be any integer, but the inverse exists only if gcd(a, m) = 1. Check that condition if you get no solution.
- The result is given in the range 0 to m-1, which is the standard representation of modular inverses.
- If you need the inverse for negative a, the calculator will handle it by using the modulo operation, but the result will still be in the range 0 to m-1.
Common Mistakes to Avoid
- Assuming an inverse always exists. It only exists when a and m are coprime.
- Forgetting that the inverse is unique modulo m, so any integer congruent to the result is also an inverse.
- Using a modulus of 0 or negative values, which are not valid for modular arithmetic.
Last updated: August 13, 2026