Modulo Calculator

The modulo operation gives the remainder after division. For positive numbers everyone agrees: 17 mod 5 = 2. For negative numbers, languages disagree. This calculator shows all three conventions side by side.

a mod n = a − n × ⌊a ÷ n⌋

Example: −17 mod 5 is 3 in Python and Excel (floored) but −2 in JavaScript and C (truncated).

Everyday uses of modulo

  • Clock arithmetic: 10 hours after 9 o’clock is (9 + 10) mod 12 = 7 o’clock.
  • Even or odd: n mod 2 is 0 for even numbers and 1 for odd ones.
  • Days of the week: 100 days after a Monday is 100 mod 7 = 2 days later, a Wednesday.
  • Check digits in ISBNs and bank account numbers.