Math

Modular Multiplicative Inverse Calculator

Find x such that a×x ≡ 1 modulo m, when the inverse exists.

Exact method explained belowEditable inputs
Calculation notebook
Calculation notebook

The formula and worked example below explain the calculation.

See the method

Enter your values

Runs on your device

Your answer

Your result

Let’s calculate.

Use the Calculate button to see your result.

Review the method below for assumptions and conventions.

How to use this tool

  1. Enter integer a, modulus m.
  2. Select Calculate to view the result.
  3. Check the method and assumptions below before using the result.

The method, explained

An inverse exists exactly when gcd(a,m)=1. The extended Euclidean algorithm finds a Bézout coefficient for a, which is normalized into the range 0 through m−1.

A WORKED EXAMPLE

Using integer a = 7, modulus m = 26, the result is 15. Change these example inputs to match your task; use the method above to check each step.

Understanding your result

When a and m share a factor greater than one, every multiple of a retains that factor modulo m and cannot be congruent to one.

What to keep in mind

Integer inputs up to 200 digits. This demonstrates number theory and is not a cryptographic security service. Finite-precision arithmetic is used. Check the domain and the stated convention before using an approximation.

Common questions

Why can an inverse fail to exist?

When a and m share a factor greater than one, every multiple of a retains that factor modulo m and cannot be congruent to one.

How can I check the result?

An inverse exists exactly when gcd(a,m)=1. The extended Euclidean algorithm finds a Bézout coefficient for a, which is normalized into the range 0 through m−1. The worked example uses editable inputs. Calculations run on your device; no external API or account is required.

Methodology maintained by ClarityKit. How these tools are built and checked.