2026-09-29 8 min

Modular Inverse Calculator

Find a⁻¹ mod m by extended Euclid with existence check, Bezout coefficients, and multiply-to-1 verification.

Calculator

Inverse Inputs

Number (a) Help

Value to invert

Modulus (m) Help

Must exceed 1

Results update live as you type
Status:(3)⁻¹ mod 11 = 4 ✓

Inverse Summary

Inverse4
GCD(a, m)1
Verification(a×inv) mod m = 1
3 = 11 × 0 + 3
11 = 3 × 3 + 2
3 = 2 × 1 + 1
2 = 1 × 2 + 0
Bezout x = 4

Results

Optimal

Inverse a⁻¹ mod m

4

(3)⁻¹ mod 11

GCD(a, m)

1

Equals 1 — inverse valid

Verification (a·inv mod m)

1

Must equal 1

Bezout x

4

Raw coefficient pre-normalization

Residue Range

0 … 10

Inverse lives here

Extended Euclid is exact for these inputs; the GCD gate decides existence and the multiply-to-1 check certifies every inverse.

Visualizations

Inverse vs modulus

3a mod m
4inverse
11m

Inverse position

inv / m36%

GCD gate

GCD1

Formula

Extended Euclid runs the remainder chain while tracking how each remainder combines a and m; at GCD 1 the a-coefficient is the inverse.

a·x + m·y = GCD(a, m); GCD = 1 ⟹ x ≡ a⁻¹ (mod m)

Alternative Form

Verify: (a × inv) mod m = 1

Variables

SymbolNameUnitDescription
aValueintegerNumber being inverted
mModulusintegerExceeds 1
x, yBezout coefficientsintegersCombine a and m into the GCD
invInverseintegerNormalized x in 0…m−1

Explanation

The verification bar stacks the product as full m-blocks: everything cancels except a green tip of exactly 1.

Derivation

Invariant a·xᵢ + m·yᵢ = rᵢ across Euclid rows; at r = GCD = 1, a·x ≡ 1 (mod m). Normalizing x fixes the unique class representative.

Step-by-Step Calculation

Follow each step to understand how the result is calculated from your inputs.

Step 1

Normalize a onto the clock.

a mod m
a:3 → 3
Result: Working with 3 mod 11
Step 2

Run extended Euclid tracking coefficients.

Maintain a·x + m·y = remainder
Intermediate: 3=11×0+3; 11=3×3+2; 3=2×1+1; 2=1×2+0
Result: GCD = 1 with x = 4
Step 3

Read the Bezout x as the raw inverse.

3×(4) + 11×y = 1
x:4
Result: Raw inverse candidate: 4
Step 4

Normalize the candidate into range.

inv = ((x % m) + m) % m
x:4
m:11
Result: Inverse = 4
Step 5

Verify by multiplying back to 1.

(a × inv) mod m = 1
product:3×4=12
Result: Verified: 1 — the green tip is exactly 1
Final Answer
4

Worked Examples

See how the calculator works with different scenarios.

Scenario

Default textbook pair.

Inputs

a:3
m:11

Calculation

11=3×3+2; 3=2×1+1 Back-substitute → x = 4

Result

Inverse = 4 (3×4=12≡1)

Interpretation

Dividing by 3 mod 11 means multiplying by 4.

Understanding Your Result

Your Result: a⁻¹ mod m or a proven no-inverse verdict — see the result cards.

Typical range: Inverses always land in 0…m−1; existence fails exactly for non-coprime pairs.

What This Means

The inverse is the key that undoes multiplication by a on the m-clock; GCD > 1 means no such key exists.

Why It Matters

Private RSA keys, cipher decryption, and finite-field fractions are all modular inverses in disguise.

Professional Interpretation

A verified 1 is safe to deploy as a decryption exponent or field divisor; a GCD obstruction redirects to the congruence solver.

Recommendations

  • •Verify (a·inv) mod m = 1 always
  • •Normalize negatives before Euclid
  • •Read GCD > 1 as impossible
  • •Use the inverse for modular division
  • •Keep m above 1

Educational Content

Introduction

Modular arithmetic has no division button — instead, the inverse turns division into multiplication by a special partner.

Concept Explanation

Extended Euclid expresses the GCD as a combination of a and m; when that combination equals 1, the a-part is the inverse.

Applications

▸RSA private-key derivation
▸Affine cipher decryption
▸Finite-field fraction arithmetic
▸Solving linear congruences
▸Elliptic-curve point math
▸Reversing hash multipliers

Benefits

  • •Existence gate included
  • •Bezout coefficients exposed
  • •Multiply-to-1 verification
  • •Negative-safe normalization
  • •Impossibility explained

Limitations

  • •Requires GCD(a, m) = 1
  • •m must exceed 1
  • •10M input cap

Best Practices

  • •Check GCD first
  • •Normalize a mod m early
  • •Wrap negative x forward
  • •Verify with one multiply
  • •Route GCD > 1 to congruences

Common Misconceptions

Myth: Every number has a modular inverse.
Truth: Only numbers coprime to m qualify — 6 mod 10 has none.
Myth: The inverse is found by division.
Truth: It is found by combination (Bezout), then verified by multiplication.
Myth: Negative Bezout x is an error.
Truth: It is normal: wrap it forward mod m to get the canonical inverse.
Myth: 1/m works mod m.
Truth: Fractions do not exist here; the inverse is the integer x with a·x ≡ 1.

Practical Tips

  • •Check GCD(a, m) = 1 before trusting output
  • •Normalize a into 0 … m−1 first
  • •Wrap negative Bezout x forward
  • •Verify with one multiply to 1
  • •Read GCD > 1 as provably impossible
  • •Use the inverse to divide mod m
  • •Keep m strictly above 1

Common Mistakes

Assuming an inverse always exists
Gate on the GCD: only 1 admits an inverse.
Reporting raw negative x
Normalize into 0…m−1 — the canonical inverse.
Skipping verification
One multiply confirms (a·inv) mod m = 1; never deploy unverified.
Dividing mod m directly
Multiply by the inverse instead — that is what division means here.
Allowing m = 1
A one-residue clock admits no inverses; require m > 1.

Assumptions

This calculator makes the following assumptions to provide estimates:

Integer inputs: a and m parse as base-10 integers.
Modulus above 1: m ≥ 2 enforced before math.
Normalized Euclid: Euclid runs on (a mod m, m).
10M cap: Inputs stay within 10,000,000.
Local compute: Everything runs in the browser; nothing is uploaded.

Limitations

Be aware of these limitations when using this calculator:

Coprime gate: Non-coprime pairs get verdicts, not inverses.
m > 1 required: Degenerate single-residue clocks excluded.
10M cap: Crypto-scale moduli need offline tools.
Single pair: One (a, m) per run.

Frequently Asked Questions

Answers to common questions about this calculator.

What is a modular inverse?
The x with a·x ≡ 1 (mod m) — modular division by a. For 3 mod 11 the inverse is 4, since 3×4 = 12 ≡ 1.
When does a modular inverse exist?
Exactly when GCD(a, m) = 1. Sharing a factor makes a·x ≡ 1 impossible — e.g. 6 has no inverse mod 10.
How is the inverse computed?
Extended Euclid finds x, y with a·x + m·y = GCD. When the GCD is 1, x (normalized into 0…m−1) is the inverse.
How do you verify an inverse?
Multiply: (a·inv) mod m must equal 1. The green-tip bar shows the product as full m-blocks plus exactly 1.
Why normalize a into 0…m−1 first?
Congruent inputs share inverses, and normalizing keeps Euclid small and the certificate clean — −4 mod 11 behaves as 7.
Where are modular inverses used?
RSA private keys, Diffie–Hellman division, fraction-style math in finite fields, and solving linear congruences.
Is the inverse unique?
Yes, modulo m: exactly one residue in 0…m−1 works. Adding m just names the same class again.
What if GCD(a, m) is not 1?
No inverse exists — the tool reports the GCD as the obstruction and suggests the congruence solver instead.
Can m be 1?
No useful inverse exists: every integer ≡ 0 (mod 1), so 1 ≡ 0 and the equation collapses. The tool requires m > 1.

Related Calculators

Explore more calculators related to this topic.

Related Guides

Deepen your understanding with these educational resources.

Glossary

Technical terms used in mortgage calculations explained in plain language.

Modular inverse
x with a·x ≡ 1 (mod m).
Extended Euclid
Euclid tracking combination coefficients.
Bezout identity
a·x + m·y = GCD(a, m).
Coprime
GCD 1 — the inverse precondition.
Normalization
Wrapping into 0…m−1.
Verification product
(a·inv) mod m, must be 1.
Obstruction
A GCD above 1 blocking inversion.
Finite field
Mod-prime arithmetic where every nonzero value inverts.

Authoritative References

Trusted sources and standards referenced by this calculator.

Applicable Standards

Common Core HSA-APR — arithmetic with polynomials and structureNCTM Number and Operations — algorithms and inverses

Was This Calculator Helpful?

Page Information

Last Updated:

2026-09-29

Version:

2.0.0

License:

Free to use for educational and professional purposes.