Math Last updated: July 2026

Inverse Modulo Calculator

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.

How to Use the Inverse Modulo Calculator

Interactive calculator available after JavaScript loads.

Loading calculator...

Written by Calculator Archive Team

Math & Finance Experts — Verified Formulas, Peer-Reviewed Sources, Expert Analysis

Looking for a deeper explanation?

Read our comprehensive, peer-reviewed educational article in our Blog to learn the underlying math, formulas, and step-by-step examples.

Read Blog Guide ›

Mathematical Formula & Logic

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 Glossary
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

Step-by-Step Worked Calculation

Scenario: 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 —

How to Use the Inverse Modulo Calculator

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

What Is a Inverse Modulo Calculator?

Inverse Modulo Calculator is a mathematical computation tool that helps you calculate the modular inverse of any integer instantly. Free online inverse modulo calculator using the Extended Euclidean Algorithm with step-by-step solutions. It applies established mathematical principles to deliver accurate results, often showing the underlying formula and step-by-step working so you can understand the computation process.

Why This Calculation Matters

Mathematical calculations form the foundation of science, engineering, finance, and everyday problem-solving. Inverse Modulo Calculator helps you work through calculations accurately and efficiently, reducing the risk of manual arithmetic errors. Whether you are a student learning concepts, a professional verifying work, or anyone needing quick and reliable math results, this tool ensures precision and saves time.

Historical Background

Mathematics has evolved over thousands of years, from ancient Babylonian clay tablets and Egyptian papyri to Greek formal proofs by Euclid and Archimedes. The development of algebra by Persian mathematician al-Khwarizmi in the 9th century and the invention of calculus by Newton and Leibniz in the 17th century laid the groundwork for modern computation. Inverse Modulo Calculator continues this tradition by making mathematical operations accessible through digital technology.

Frequently Asked Questions

Complete indexable directory of answers (13 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.

What mathematical formula does the Inverse Modulo Calculator use?

The Inverse Modulo Calculator uses standard mathematical formulas validated against authoritative references. The specific formula is displayed in the calculator interface with a detailed explanation of each variable.

How can I verify the Inverse Modulo Calculator results manually?

Each calculator includes a step-by-step worked example showing exactly how the formula is applied. You can follow these steps with pen and paper to verify any result.

What types of inputs does the Inverse Modulo Calculator accept?

The Inverse Modulo Calculator accepts numeric inputs including integers and decimals. Invalid inputs (letters, special characters) are rejected with clear error messages.