Modular Multiplicative Inverse Calculator
Find the multiplicative inverse of a modulo m, or say exactly why none exists.
Modular Multiplicative Inverse Calculator
Find the multiplicative inverse of a modulo m, or say exactly why none exists.
What the page prints, and what it refuses
Every figure is printed with the rule or formula that produced it, and any numerical tolerance is stated on the result rather than implied. The page refuses an input the formula does not define and names the value it read; it prints no answer it cannot support.
The calculation runs entirely in this browser tab; nothing is uploaded.
The page finds the number that multiplies a to 1 modulo m. The inverse of 3 modulo 11 is 4, because 3 × 4 = 12 ≡ 1 (mod 11).
An inverse exists exactly when a and m are coprime. The page computes the gcd first and refuses the case where it is not 1, naming the gcd, rather than printing a meaningless number.
Why coprimality is the whole condition
a·x ≡ 1 (mod m) has a solution exactly when some combination a·x + m·y equals 1, which is Bézout's identity and holds exactly when gcd(a, m) = 1. The extended Euclidean algorithm produces that x.
The answer is reduced into 0 … m−1, and the check line multiplies it back. The inverse is unique modulo m, so there is one right answer rather than a family.
How to use Modular Multiplicative Inverse Calculator
Enter a and a modulus of at least 2, then press Run.
The first line is the inverse. The equation and the multiplication check follow; a non-coprime pair gets a refusal naming the gcd.
What to Expect
Best for
- Solving a·x ≡ 1 (mod m)
- Checking a step in an RSA key calculation
- Seeing why an inverse does or does not exist
Not ideal for
- A composite pair with a shared factor
- A modulus of 1, where every number is congruent to 0
- Dividing numbers in modular arithmetic, which is this operation
What this tool keeps
- a and the modulus exactly
What may need cleanup
- Nothing: the inverse is a final integer
Common errors
- A non-coprime pair is refused with the gcd named
- A modulus below 2 is refused
Example use cases
- Find 3⁻¹ mod 11
- See that 6 has no inverse mod 9
- Check an RSA private exponent
Sample input
a = 3, modulus = 11
Sample output
3⁻¹ mod 11 = 4, and 3 × 4 mod 11 = 1
Who this is for
- Number theory students
- Readers checking a cryptography step
Frequently asked questions
Why does 6 have no inverse modulo 9?
Both are divisible by 3, so every multiple of 6 is divisible by 3 and can never be congruent to 1 modulo 9. The page prints that gcd as the reason.
Is the inverse unique?
Yes, modulo m. Any two inverses differ by a multiple of m, so reducing into 0 … m−1 gives one value.
Can a be larger than the modulus?
Yes. The page reduces a modulo m before solving, and the check uses the original value.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.