HomeCalculatorsMathNumber Theory & Discrete MathModular Inverse Calculator
Math calculator

Modular Inverse Calculator

Modular inverse of a modulo m when gcd(a,m)=1. Same engine as Euclidean remainder. Not a second GCF page. Runs locally.

Instant result
Result

Enter values to calculate.

Inputs
Mode
Formula
Trust summary Engine tested · Specification checked · 13/13 tests · Production surface contract 4/4 · v1.1.0
Input interpretation
Enter values to calculate.
Result
Model
x in [0, |m|) with a x ≡ 1 (mod m) when gcd(a,m)=1.
Scope
Integers
Verification
Engine tested · 13/13 tests · Production surface contract 4/4 · Specification checked · v1.1.0
Named expert review
Optional · Not performed
Specification basis
  • ISO 80000-2:2019 Quantities and units — Mathematics
  • Knuth, The Art of Computer Programming, extended Euclidean algorithm
Specification basis
Evidence
3 golden · 4 boundary · 6 property · Production surface contract 4/4 · Artifact integrity PASS
Production
Embedded snapshot: STALE · Last attested schema matched 1.1.0 snapshot / local build · Semantic contract ✓ · Last attestation PASS · current evidence changed · re-attestation required · Public/cache ✓ · Origin ✓ · Live production status STALE (1 capability; 163 remain CURRENT) @ 2026-09-19T00:00:17.039Z
Semantic contract
PASS

Formulas

Core equations used by this calculator.

Congruencea x ≡ 1 (mod m)
Bézouta x + m y = 1
iExtended Euclidean algorithm. Inverse is returned in [0, |m|). |m| ≥ 2. gcd(a,m) must be 1. Not JavaScript %. Integers only. Float64 is not used.

How to use

1

Enter a and a modulus

|m| ≥ 2. Remainder still lives at /calc/math/modulo.

2

Read the inverse

If gcd ≠ 1 the engine returns NOT_INVERTIBLE. GCF is /calc/math/gcf.

Example calculations

Common configurations with formula and result.

ϟ

3⁻¹ mod 11

3·4 = 12 ≡ 1

3x ≡ 1 (mod 11)
4
ϟ

Not invertible

gcd(2,4)=2

2x ≡ 1 (mod 4)
NOT_INVERTIBLE

Modular Inverse calculator specification

Version 1.1.0 · Engine tested

Calculation status

Review policy · Evidence

Definition
x is a modular inverse of a modulo m when a x ≡ 1 (mod m). This page is mode=inverse on the modulo engine. Remainder and GCF are separate intents.
What it calculates
x in [0, |m|) with a x ≡ 1 (mod m) when gcd(a,m)=1.
Inputs
  • a
  • modulus
Outputs
  • inverse
  • gcd
  • identity
Formula
ax ≡ 1 (mod m)
Assumptions
  • Integers
  • Euclidean remainder convention
  • |m| ≥ 2
  • Not GCF
Units
  • dimensionless
Boundary conditions
  • gcd ≠ 1 → NOT_INVERTIBLE
  • |m| < 2 → INVALID_INPUT
  • modulus = 0 → DIVISION_BY_ZERO
Example
a=3 modulus=11 → inverse=4
Validation cases

2 published on this page · 13/13 tests · Production surface contract 4/4 · View evidence

  • a=3 modulus=11 → inverse=4
  • a=2 modulus=4 → error NOT_INVERTIBLE
Specification basis
  • ISO 80000-2:2019 Quantities and units — Mathematics
  • Knuth, The Art of Computer Programming, extended Euclidean algorithm
Calculation version
1.1.0
}

Frequently asked questions

Key distinctions behind the calculation.

Is this a second GCF calculator?

No. gcd is computed only to decide invertibility. GCF stays /calc/math/gcf.

Is this a second remainder page?

No. It is mode=inverse on math.modulo, the same engine as /calc/math/modulo.

Where does this run?

Locally in the browser by default. REST and MCP call the same modulo engine.