Since 2010 · Powering 2M+ tool runs every month
Since 2010
Add to Chrome

My Toolbox

Automatic Mode

No saved tools yet.

Go Premium
Home Page > Math > Advanced Math Operations

Modular Multiplicative Inverse Calculator

MiniWebtool’s Modular Multiplicative Inverse Calculator looks for x such that ax ≡ 1 modulo m. The Extended Euclidean Algorithm explains the calculation and reveals when no inverse exists because a and m are not coprime.

Need help using this tool? Ask AI

For Gemini, paste the copied question into the chat. You can also copy it below.

View the question

3 free uses dailyNo sign-up requiredInstant Results
Modular Multiplicative Inverse CalculatorTry it now — free ▼
The inverse of 3 mod 7 is the multiple of 3 that lands on 1

Enter a number a and a modulus m below to get the modular inverse of a (if it exists), with the Extended Euclidean steps and a clock view.

⚡ Quick Examples
Any non-zero integer
Positive integer ≥ 2

Embed Modular Multiplicative Inverse Calculator Widget

About Modular Multiplicative Inverse Calculator

What Is the Modular Multiplicative Inverse?

The modular multiplicative inverse of an integer a with respect to modulus m is an integer x in the range [0, m-1] such that:

\( a \cdot x \equiv 1 \pmod{m} \)

It is written as a⁻¹ (mod m) and is analogous to the multiplicative inverse in ordinary arithmetic (i.e., 1/a), but in the world of modular arithmetic.

Key condition: The inverse exists if and only if gcd(a, m) = 1 — that is, a and m must be coprime.

At a Glance

Modular Multiplicative Inverse Calculator finds x such that a*x is congruent to 1 modulo m. It uses the Extended Euclidean Algorithm and reports when no inverse exists because a and m share a factor.

Modular Multiplicative Inverse Calculator: features at a glance
FeatureWhat you getGood for
Integer and modulusEnter an integer a and a modulus m of at least 2. Negative integers are reduced modulo m first.Inverse problems in modular arithmetic
Canonical resultThe inverse is reported in the range 0 to m - 1, for example 3^-1 mod 7 = 5.Getting one standard answer
Extended EuclidSolves a*x + m*y = gcd(a, m) and shows the steps of the Extended Euclidean Algorithm.Showing work in number theory classes
Coprime checkComputes the GCD to test whether a and m are coprime. If not, no inverse exists, as with 2 mod 9.Understanding why an inverse is missing
Fermat's methodWhen the modulus is prime, the page supports the Fermat's Little Theorem method, a^(m-2) mod m.Prime moduli in competitive programming
Example buttonsPresets cover 3 mod 7, 5 mod 11, RSA 17 mod 3120, a no-inverse case and an affine cipher 7 mod 26.Cryptography practice problems

How It Is Calculated: Extended Euclidean Algorithm

The most efficient method uses the Extended Euclidean Algorithm. It finds integers x and y satisfying Bézout's identity:

\( a \cdot x + m \cdot y = \gcd(a, m) = 1 \)

When gcd(a, m) = 1, taking both sides mod m gives a·x ≡ 1 (mod m), so x is the modular inverse.

Example: Find 3⁻¹ (mod 7):

Extended GCD gives: 3·(5) + 7·(-2) = 15 − 14 = 1, so 3⁻¹ ≡ 5 (mod 7). Verify: 3 × 5 = 15 = 2×7 + 1 ≡ 1 (mod 7) ✓

Applications in Cryptography & Mathematics

🔐
RSA Encryption
Finding the private key d = e⁻¹ (mod φ(n)) from public exponent e
📈
Diffie-Hellman
Key exchange protocol based on discrete logarithms in modular arithmetic
🇮
Affine Cipher
Decryption uses a⁻¹ (mod 26) to reverse the encryption key
🔢
CRT & Number Theory
Chinese Remainder Theorem and solving linear congruences ax ≡ b (mod m)
👑
Elliptic Curves
Point addition formulas in ECC require modular inverses for slope computation
📋
Modular Fractions
Computing a/b (mod m) as a · b⁻¹ (mod m) when gcd(b, m) = 1

Frequently Asked Questions

Q: Why does the inverse not always exist?
Because modular arithmetic "wraps around," some multiples of a may never land on 1 mod m. This happens exactly when a and m share a common factor — i.e., gcd(a, m) > 1.
Q: Is there a formula for prime modulus?
Yes! If m is prime and a is not a multiple of m, Fermat's Little Theorem gives: a⁻¹ ≡ am-2 (mod m). This is often used in competitive programming.
Q: Is the result unique?
Yes, the result is unique modulo m. We always report the canonical result in [0, m-1]. Other valid inverses are x + km for any integer k, but they are all equivalent mod m.
Q: What if a is negative?
The algorithm handles negative integers. Internally we compute a (mod m) to get a non-negative representative first, then find its inverse. The result is always in [0, m-1].

Reference this content, page, or tool as:

"Modular Multiplicative Inverse Calculator" at https://MiniWebtool.com/modular-multiplicative-inverse-calculator/ from MiniWebtool, https://MiniWebtool.com/

by miniwebtool team. Updated: Feb 18, 2026

Chat with your favorite AI

For Gemini, paste the copied question into the chat. You can also copy it below.

View the question

Advanced Math Operations:

Top & Updated:

Inverse Function CalculatorInverse Laplace Transform CalculatorMatrix Inverse CalculatorView all →
Home Page > Math > Advanced Math Operations > Modular Multiplicative Inverse Calculator