Skip to content

Inverse Modulo Calculator

Find the modular multiplicative inverse with the extended Euclidean algorithm, for very large integers.

AvailableRuns in your browserFree · No sign-up

Inverse Modulo Calculator

Can be negative.

A positive integer, up to 600 digits.

Enter a and m to find x with a·x ≡ 1 (mod m).

How it works

Find x such that a · x ≡ 1 (mod m)

The extended Euclidean algorithm finds integers s and t with s·a + t·m = gcd(a, m). If the gcd is 1, then s·a ≡ 1 (mod m), so s (taken modulo m) is the inverse. A negative a is first reduced to the range 0…m−1. All arithmetic uses exact big integers, never floating point.

Your data is processed locally in your browser and is not uploaded to OZVILO servers.

How to use the Inverse Modulo Calculator

  1. 1Enter the integer a and the modulus m.
  2. 2Read the inverse x with a·x ≡ 1 (mod m), or an explanation if no inverse exists.
  3. 3Check the step table of the extended Euclidean algorithm and the Bézout identity.

Examples

  • Small numbers

    Input
    a = 3, m = 11
    Result
    3⁻¹ ≡ 4 (mod 11), since 3 × 4 = 12 ≡ 1
  • RSA textbook example

    Input
    a = 17, m = 3120
    Result
    17⁻¹ ≡ 2753 (mod 3120)
  • No inverse

    Input
    a = 6, m = 9
    Result
    gcd(6, 9) = 3, so no inverse exists

Inverse Modulo Calculator features

  • Extended Euclidean algorithm with steps
  • Exact BigInt arithmetic (up to 600 digits)
  • Negative a handled
  • Bézout coefficients

Frequently asked questions

When does a modular inverse exist?

Exactly when a and m are coprime, that is gcd(a, m) = 1. If they share a factor, every multiple of a is also a multiple of that factor modulo m, so a·x can never be 1.

How is the inverse found?

The extended Euclidean algorithm finds integers s and t with a·s + m·t = gcd(a, m). If the gcd is 1, then a·s ≡ 1 (mod m), so s reduced modulo m is the inverse.

Can I use very large numbers?

Yes. All arithmetic uses exact BigInt integers, so numbers with hundreds of digits — like those in RSA examples — give exact results.