Modulo Calculator

Calculate the modulo (remainder) of any two integers: a mod n = r.
Shows quotient, remainder, step-by-step division, and clock arithmetic examples.

Modulo Result

Modulo (mod) returns the remainder after dividing one number by another.

a mod b = a − b × floor(a / b)

Or equivalently: a = b × quotient + remainder

Examples:

  • 17 mod 5 = 2 (17 = 5 × 3 + 2)
  • 25 mod 7 = 4 (25 = 7 × 3 + 4)
  • 100 mod 10 = 0 (100 = 10 × 10 + 0)
  • 7 mod 3 = 1 (7 = 3 × 2 + 1)

Clock arithmetic (mod 12):

  • If it is 10 o’clock and you add 5 hours: (10 + 5) mod 12 = 3 o’clock
  • If it is 7 o’clock and you add 20 hours: (7 + 20) mod 12 = 3 o’clock

Common uses:

  • Even/odd check: n mod 2 → 0 = even, 1 = odd
  • Cycling/wrapping: array indices, day of week
  • Digit extraction: n mod 10 gives the last digit
  • Divisibility test: n mod d = 0 means n is divisible by d
  • Cryptography: RSA encryption uses modular exponentiation

Negative numbers:

  • In mathematics: −7 mod 3 = 2 (remainder is always non-negative)
  • In some programming languages: −7 % 3 = −1 (sign matches dividend)
  • This calculator uses the mathematical definition

How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.