Find an inverse modulo m
Enter an integer a and a modulus m greater than 1. The result is the unique integer x between 0 and m − 1 for which a × x has remainder 1 modulo m. For example, the inverse of 3 modulo 11 is 4 because 3 × 4 = 12 = 1 × 11 + 1.
When does an inverse exist?
An inverse exists exactly when a and m are coprime: their greatest common divisor is 1. The extended Euclidean algorithm finds it without trying every possible value. A non-coprime pair displays its GCD and explains why no inverse exists.
Exact arithmetic and input limits
Negative integers are normalized to their nonnegative residue. Inputs accept up to 200 digits each; decimals and exponential notation are rejected. BigInt keeps the answer exact. Everything is calculated locally in your browser.