Math July 13, 2026 · 8 Min Read

Inverse Modulo Calculator – Guide & Formulas

Calculate the modular inverse of any integer instantly. Free online inverse modulo calculator using the Extended Euclidean Algorithm with step-by-step solutions.

Find the modular inverse of any integer with our free online Inverse Modulo Calculator. Enter two coprime numbers to compute ax ≡ 1 (mod m) using the Extended Euclidean Algorithm.

Key Takeaway

Use the free Inverse Modulo Calculator to calculate the modular inverse of any integer instantly. free online inverse modulo calculator using the extended euclidean algorithm with step-by-step solutions. Get instant results with step-by-step explanations.

How to Use the Inverse Modulo Calculator

  1. Step 1: Enter the integer a (the number you want to invert)
  2. Step 2: Enter the modulus m (must be a positive integer greater than 1)
  3. Step 3: Click Calculate to find the modular inverse x such that (a × x) mod m = 1
  4. Step 4: Review the step-by-step Extended Euclidean Algorithm solution below the result

The Formula

a × x ≡ 1 (mod m) — Find x such that (a × x) mod m equals 1. The modular inverse exists only when gcd(a, m) = 1 (a and m are coprime).

Variable Definitions

  • a: The integer to invert (must be coprime with m)
  • m: The modulus (must be a positive integer > 1)
  • x: The modular inverse of a modulo m (the result)
  • gcd(a, m): Greatest common divisor of a and m; must equal 1 for the inverse to exist
  • : Congruence symbol — means "is congruent to" in modular arithmetic

Finding the Modular Inverse of 3 mod 7

Find x such that 3x ≡ 1 (mod 7)

  1. Check gcd(3, 7): Since 7 is prime and does not divide 3, gcd(3, 7) = 1. The inverse exists.
  2. Apply Extended Euclidean Algorithm: 7 = 2 × 3 + 1, so 1 = 7 − 2 × 3.
  3. Rearrange: 1 = (−2) × 3 + 1 × 7, so the coefficient of 3 is −2.
  4. Convert to positive: −2 mod 7 = 5. Therefore x = 5.
  5. Verify: 3 × 5 = 15, and 15 mod 7 = 1 ✓

Frequently Asked Questions

What is a modular inverse?

The modular inverse of an integer a modulo m is an integer x such that (a × x) mod m = 1. It exists only when a and m are coprime (their greatest common divisor is 1).

How do I find the modular inverse?

Use the Extended Euclidean Algorithm to find integers x and y such that ax + my = gcd(a, m). If gcd(a, m) = 1, then x mod m is the modular inverse of a modulo m.

When does a modular inverse not exist?

A modular inverse of a modulo m does not exist when gcd(a, m) > 1, meaning a and m share a common factor greater than 1. For example, the inverse of 2 mod 4 does not exist because gcd(2, 4) = 2.

What is the modular inverse of 1?

The modular inverse of 1 modulo any integer m is always 1, since 1 × 1 = 1 and 1 mod m = 1 for any positive integer m > 1.

Is the modular inverse unique?

Yes, when it exists, the modular inverse is unique modulo m. That is, there is exactly one value x in the range 0 to m−1 such that (a × x) mod m = 1.

What is the Extended Euclidean Algorithm?

The Extended Euclidean Algorithm is an extension of the Euclidean Algorithm that not only computes gcd(a, b) but also finds integers x and y satisfying ax + by = gcd(a, b). It is the standard method for computing modular inverses.

Can the modular inverse be negative?

The modular inverse is typically expressed as a positive integer between 0 and m−1. If the algorithm yields a negative result, add m to convert it to the equivalent positive value in the range [0, m−1].

What are practical uses of modular inverses?

Modular inverses are essential in cryptography (RSA encryption), error-correcting codes, computing modular division, solving linear congruences, and in many areas of number theory and abstract algebra.

How does this calculator handle large numbers?

This calculator uses the Extended Euclidean Algorithm which works efficiently with large integers. Simply enter numbers of any size and the algorithm will compute the result step by step.

What is the difference between modular inverse and regular division?

Regular division gives a fraction or decimal, while modular inverse gives an integer. The modular inverse of a modulo m is the number x such that multiplying by x is equivalent to dividing by a in modular arithmetic.