Modulo Calculator
Math
Works out the remainder of a division (mod), the quotient, modular exponentiation and the modular inverse.
a mod m = a - m × ⌊a ÷ m⌋
17 mod 5 = 2 (17 = 3 × 5 + 2)
-7 mod 3 = 2 (the mathematical modulo is always between 0 and m - 1)
3⁴ mod 5 = 81 mod 5 = 1
Clocks (mod 12), weekdays (mod 7), and ISBN and IBAN check digits all run on modular arithmetic.
The % operator in Swift and C gives a different result for negative numbers: -7 % 3 = -1. The tool shows both. A modular inverse exists only when a and m are coprime.
Results are for information only. For tax, salary, loan or health decisions, check official sources or ask a professional.