🌐 EN

Modulo Calculator

Enter integers and a modulus to calculate modular arithmetic, powers, and an inverse.

Basic Modulo — Modular Addition — Modular Subtraction — Modular Multiplication — Modular Exponentiation — Modular Inverse —

Inputs and checks

  • Enter integers a, m, b, and exp; the starting entries are 17, 5, 8, and 3.
  • Use modulus m of at least 2. Signed integers are allowed for a and b.
  • Results update as you edit any field; there is no separate Calculate button.
  • Enter whole numbers, not decimals or exponent notation: the parser may take only the leading integer portion.

Reading the result

  • Six fields show the basic remainder, modular sum, difference, product, power, and inverse. Remainders are normalized to 0 through m−1.
  • An inverse exists only when gcd(a,m)=1; otherwise it shows N/A. Negative powers also need that inverse.
  • This is a remainder calculator, not an RSA key generator or encryption tool.

Examples

Modular operations with 17 and 8

Input
a: 17; m: 5; b: 8; exp: 3
Result
Basic: 2; add: 0; subtract: 4; multiply: 1; power: 3; inverse: 3
How to check it
17 mod 5 = 2; 25 mod 5 = 0; 9 mod 5 = 4; 136 mod 5 = 1; 17³ = 4913 ≡ 3 (mod 5); 17×3 ≡ 1 (mod 5).

Negative modular exponent with modulus 7

Input
a: 3; m: 7; b: 4; exp: -1
Result
Basic: 3; add: 0; subtract: 6; multiply: 5; power: 5; inverse: 5
How to check it
3+4 ≡ 0; 3−4 = −1 ≡ 6; 3×4 ≡ 5 (mod 7); 3×5 ≡ 1 (mod 7), so 3⁻¹ ≡ 5.

Frequently asked questions

Why is -1 mod 7 shown as 6?
The tool chooses the nonnegative remainder in the range 0 to 6.
When does a modular inverse exist?
Only when a and m have greatest common divisor 1.
Can exp be negative?
Yes, when the base has a modular inverse; otherwise the power field shows N/A.