Modular Arithmetic

Mod, modular inverse, and properties

About this calculator

The Modular Arithmetic Calculator reduces an integer a modulo m to its least non-negative residue in [0, m), computes gcd(a, m), and finds the modular inverse a⁻¹ (mod m) via the extended Euclidean algorithm whenever a and m are coprime. It also reports the Bézout coefficients x, y with a·x + m·y = gcd(a, m). Negative inputs reduce correctly to a non-negative residue, and when no inverse exists the shared factor is shown instead of an answer being forced.

How to use the Modular Arithmetic calculator

  1. Enter the values for your problem into the input fields.
  2. Read the result — it updates instantly as you type.
  3. Check the formula and the visual explanation to follow how the answer was found.
  4. Copy the page URL to share the exact calculation.

Common examples

  • 27 mod 5 → residue 2, gcd 1, inverse 3 (27·3 = 81 ≡ 1 mod 5)
  • 3 mod 7 → inverse 5, since 3·5 = 15 ≡ 1 (mod 7)
  • −13 mod 10 → residue 7, inverse 3
  • 4 mod 6 → gcd 2, not coprime: no modular inverse exists

Frequently asked questions

How does the Modular Arithmetic calculator work?

Enter your values and the calculator applies the exact mathematical method for this problem, showing the result together with the formula it used. Everything is computed with high-precision arithmetic, so the answer you see is not limited by ordinary floating-point rounding.

When would I use the Modular Arithmetic calculator?

It is useful for homework and exam preparation, for checking work done by hand, and whenever a step in a larger problem needs this calculation done quickly and reliably.

How accurate are the results?

Calculations run at 30 significant digits of precision internally. Displayed values are rounded for readability, but the underlying result is far more precise than a typical hand or pocket-calculator computation.

Can I share a specific calculation with someone else?

Yes. Every value you enter updates the URL, so copying the address bar and sharing the link reopens the exact same calculation for whoever clicks it.