Modular Inverse Calculator

Modular Inverse Calculator finds the inverse of a modulo m, checks gcd existence, and shows extended Euclidean algorithm steps.

835.0K usesUpdated · 2026-04-30Runs locally · zero upload

How to Use Modular Inverse Calculator

Modular Inverse Calculator needs two integers: the value a and the modulus m. Enter both values, and Modular Inverse Calculator first reduces a modulo m. It then computes gcd(a, m). If the gcd is 1, Modular Inverse Calculator returns the smallest non-negative inverse x. If the gcd is not 1, Modular Inverse Calculator explains that no inverse exists.

The result area includes the normalized a, the gcd value, the existence decision, and a congruence check. Modular Inverse Calculator also shows Euclidean division steps so the result can be followed instead of treated as a black box.

Formula & Theory — Modular Inverse Calculator

Modular Inverse Calculator solves:

a x x = 1 mod m

The condition is:

gcd(a, m) = 1

When the gcd is 1, the extended Euclidean algorithm gives integers s and t such that a x s + m x t = 1. The coefficient s is then reduced modulo m to get the modular inverse. Modular Inverse Calculator exposes those steps, including the division chain and the Bezout form.

Use Cases for Modular Inverse Calculator

Modular Inverse Calculator is useful for number theory, congruence equations, cryptography examples, RSA teaching, coding contests, and algorithm practice. Students can use Modular Inverse Calculator to understand why coprime numbers matter. Programmers can use Modular Inverse Calculator to verify modular division in competitive programming. Teachers can use Modular Inverse Calculator to connect Euclidean algorithm work with modular arithmetic. Because Modular Inverse Calculator stays in the browser, it is convenient for quick examples and private experimentation.

Frequently asked questions about Modular Inverse Calculator

What does the Modular Inverse Calculator find?

It finds the smallest non-negative x such that a times x is congruent to 1 modulo m.

When does a modular inverse exist?

A modular inverse exists exactly when gcd(a, m) equals 1.

Which algorithm is used?

Modular Inverse Calculator uses the extended Euclidean algorithm to find Bezout coefficients.

Is my data stored?

No. All calculations happen in your browser; nothing is sent to a server.