Math

Modular Inverse Calculator

Find x where a·x ≡ 1 (mod m), with the GCD check.

Enter your values

ⓘ Live results

Results
Modular inverse
38
Check
17 × 38 mod 43 = 1
gcd(a, m)
1
Coprime?
Yes — the inverse exists
a mod m
17

Quick answer

The modular inverse of a mod m is the x with a·x ≡ 1 (mod m); it exists only when a and m are coprime.

a·x ≡ 1 (mod m)

How to use the Modular Inverse Calculator

  1. 1Enter the value you want to invert.
  2. 2Enter the modulus.
  3. 3If the GCD is not 1 there is no inverse — pick a different modulus.

Worked example

Using the values the calculator loads with:

Inputs

  • Value a17
  • Modulus m43

Results

  • Modular inverse38
  • Check17 × 38 mod 43 = 1
  • gcd(a, m)1
  • Coprime?Yes — the inverse exists
  • a mod m17

Frequently asked questions

Where are modular inverses used?

RSA key generation, hash tables, error-correcting codes and any modular arithmetic where you need to 'divide'.

Why must a and m be coprime?

If they share a factor, every multiple of a stays inside that factor's subgroup and can never reach 1.

About this calculator

Results are estimates for general information. For medical, legal, structural or financial decisions, confirm with a qualified professional.