IP331.com | Online Tools
HomeNumber Theory ToolsModular Inverse Calculator

Modular Inverse Calculator

Find x where a x is congruent to 1 modulo m

a
mod m

Modular Inverse Formula

Find x such that a x ≡ 1 (mod m)
An inverse exists iff gcd(a, m) = 1
Extended Euclid: a x + m y = 1

A modular inverse is the modular arithmetic version of division. When a and m are coprime, extended Euclid gives a Bezout coefficient for a, and that coefficient reduced modulo m is the inverse.

The modulus must be at least 2. If gcd(a, m) is not 1, modular division by a is not valid under that modulus.

What Is a Modular Inverse?

A modular inverse of a modulo m is a number x that makes a x leave remainder 1 when divided by m. It is essential for solving modular equations and for many cryptography calculations.

Inverse Condition

The inverse exists exactly when gcd(a, m) = 1.

Extended Euclid

Bezout coefficients provide the inverse directly.

Normalization

Negative coefficients are converted to the range 0 to m-1.

Verification

The final check multiplies a by the inverse modulo m.

Example: For a = 17 and m = 43, extended Euclid finds 17 x 38 ≡ 1 mod 43, so the modular inverse is 38.

Applications of Modular Inverses

Modular Division RSA Math Congruences CRT Cryptography

Frequently Asked Questions

What is a modular inverse calculator?
A modular inverse calculator finds x such that a times x is congruent to 1 modulo m. It exists only when gcd(a,m)=1.
What formula does modular inverse use?
The inverse satisfies ax ≡ 1 (mod m). The extended Euclidean algorithm finds coefficients where ax + my = gcd(a,m).
How do I use this modular inverse tool?
Enter a and modulus m, then calculate. The tool checks gcd(a,m) and returns the normalized inverse if it exists.
When does a modular inverse not exist?
A modular inverse does not exist when a and m share a common factor greater than 1, because gcd(a,m) must equal 1.
Where are modular inverses used?
Modular inverses are used in cryptography, modular division, congruence equations, RSA math, and Chinese remainder theorem problems.

More Number Theory Tools

Free online calculators and tools covering mathematics, unit conversion, text processing, and daily life. Accurate, fast, mobile-friendly, and completely free to use.

© 2026 IP331.com — Free Online Tools. All rights reserved.

About · Contact · Privacy Policy · Cookie Policy · Terms of Use · Disclaimer · Sitemap