Skip to content
🗝️

Inverse Modulo Calculator

Find the modular multiplicative inverse of a mod m.

The modular inverse of a modulo m is the number a⁻¹ such that a x a⁻¹ = 1 (mod m). An inverse exists only when gcd(a, m) = 1.

Common cases

3⁻¹ mod 10 = 7because 3 x 7 = 21 and 21 mod 10 = 1
7⁻¹ mod 10 = 3because 7 x 3 = 21 and 21 mod 10 = 1
2⁻¹ mod 9 = 5because 2 x 5 = 10 and 10 mod 9 = 1
4⁻¹ mod 11 = 3because 4 x 3 = 12 and 12 mod 11 = 1
17⁻¹ mod 3120 = 2753because 17 x 2753 = 46801 and 46801 mod 3120 = 1
4⁻¹ mod 8 does not existbecause gcd(4, 8) = 4, not 1

Click a row to load it into the form above.

Computed in your browser - nothing is uploaded.

What Is Inverse Modulo Calculator?

The Inverse Modulo Calculator finds the modular multiplicative inverse of a modulo m using the extended Euclidean algorithm, then proves the answer on screen by showing the full product a times the inverse, its remainder modulo m, and the k in 1 plus k times m. It also reports the greatest common divisor, which is the reason an inverse exists only when that value is 1 and otherwise does not. A second field can solve the related congruence a times x = b modulo m.

Who Uses the Inverse Modulo Calculator?

Number theory students and competitive programmers use it to find the inverse needed to divide modulo m, and cryptography engineers use it to check the key steps behind RSA and Diffie-Hellman.

How to Use the Inverse Modulo Calculator

  1. Type a into the a field and the modulus into the m field, which has to be a positive whole number.
  2. Press Calculate Inverse to run the extended Euclidean algorithm over the two values.
  3. Read the verification rows for the full product, the remainder modulo m and the gcd, then add a whole number in the b field to solve a times x = b (mod m) with the same inverse.

Why Choose Our Inverse Modulo Calculator?

  • Runs entirely on integer arithmetic, so a large modulus such as an RSA prime gives an exact inverse with no floating point drift
  • The result is verified in front of you rather than asserted: the product, the remainder and the k in 1 plus k times m are all shown
  • When no inverse exists, the shared factor is named, so you learn why instead of getting a bare error
  • Ships with common cases that load into the form on click, including 17 to the power of minus 1 mod 3120 and a case that has no inverse

Try the Inverse Modulo Calculator above — it is free, fast, and works on any device. Bookmark this page to return whenever you need it.