About the Modular Inverse Calculator
The modular inverse of a number a, modulo m, is the number x such that a × x leaves a remainder of 1 when divided by m. It exists only when a and m have no common factor. The inverse is central to public-key cryptography, where it is used to build the private key from the public one. This calculator finds it with the extended Euclidean algorithm and shows the steps. Type the number a and the modulus m and the modular inverse appears at once, with a few related figures underneath, and you can copy the result with one tap. The sums run in your browser, so nothing you enter is uploaded.
Updated October 2026
How to use the Modular Inverse Calculator
- 1Enter the number a and the modulus m.
- 2Pick the units or options from the menus if the modular inverse tool offers them.
- 3Read the modular inverse in the large result box.
- 4Look at the extra rows for related figures.
- 5Press Copy result to keep the answer.
When you need the modular inverse
Students of number theory and cryptography use it for RSA, for solving linear congruences and for division in modular arithmetic. Programmers need it for hash functions, random number generators and secret-sharing schemes.
Negative numbers work: the tool first reduces a into the range 0 to m − 1. The numbers can have up to 60 digits, because the calculation uses exact big-integer arithmetic.
How the modular inverse is worked out
Find x with a × x ≡ 1 (mod m). The extended Euclidean algorithm repeats division with remainder and tracks the coefficients until the remainder is 1. The inverse of 17 modulo 3,120 is 2,753, because 17 × 2,753 = 46,801 = 15 × 3,120 + 1. This is the famous textbook RSA example. The inverse of 3 modulo 11 is 4, since 3 × 4 = 12 = 11 + 1.
Every answer on this page comes from that one rule, so you can check any result by hand with a calculator. The figures shown underneath, such as other units, are conversions of the same answer.
- Exact big numbers
- Shows Euclid's steps
- Names the common factor if none
Mistakes to avoid with modular inverse
If a and m share a factor, no inverse exists, and the tool names the common factor. For example 6 has no inverse modulo 9 because both are divisible by 3. The modulus must be at least 2. The steps shown are the division steps of the algorithm.
On phone and computer
On a phone, type into the boxes one after another and read the modular inverse underneath; Copy result puts it on the clipboard for a message or a note. On a computer the inputs sit on the left and the answer on the right, so you can change one figure and watch the modular inverse move. The modular inverse calculator works the same on both. The inverse exists only when the numbers share no factor, so factors matter. Use the GCF and LCM Calculator to check that, the Modulo Calculator for remainders, and the Prime Number Calculator when the modulus is prime.
Features
- Needs coprime numbers
- Negative a is reduced
- Check by multiplying
- Clear messages when the modular inverse inputs make no sense
- Copy the result with one tap
- Private: nothing is uploaded
Frequently asked questions
How do I calculate modular inverse?
Find x with a × x ≡ 1 (mod m). The extended Euclidean algorithm repeats division with remainder and tracks the coefficients until the remainder is 1. The inverse of 17 modulo 3,120 is 2,753, because 17 × 2,753 = 46,801 = 15 × 3,120 + 1. This is the famous textbook RSA example. The inverse of 3 modulo 11 is 4, since 3 × 4 = 12 = 11 + 1.
What is the formula for modular inverse?
Find x with a × x ≡ 1 (mod m). The extended Euclidean algorithm repeats division with remainder and tracks the coefficients until the remainder is 1. The modular inverse calculator applies it exactly and rounds only the displayed answer to six significant figures.
When does a modular inverse exist?
Only when the greatest common divisor of a and m is 1, meaning they are coprime.
What is it used for in RSA?
The private exponent d is the inverse of the public exponent e modulo (p − 1)(q − 1).
How do I check the answer?
Multiply a by the inverse and take the remainder when divided by m. It should be 1.
Is this modular inverse calculator free and private?
Yes. It is free, needs no account and runs in your browser, so the numbers you type are not uploaded or stored.