Skip to main content

Modulo Calculator – Remainder of Division

Quick answer

a mod b returns the remainder: 17 mod 5 = 2, 100 mod 7 = 2, and −7 mod 3 = 2 under the mathematical convention.

  • Clock math explained.

Figures are estimates from this calculator’s standard formula — adjust the inputs in the tool below for your exact number.

How the Modulo Calculator Works

a mod b = a − b·⌊a/b⌋ (remainder after division)

The modulo operation reports what remains after taking out whole multiples of the divisor. 17 mod 5 = 2 because 17 = 3×5 + 2; the quotient 3 is discarded and the remainder 2 is the answer. Clock arithmetic is everyday modulo: 22:00 is 10 pm because 22 mod 12 = 10, and adding 7 + 9 hours lands at 16 → 4 o’clock since 16 mod 12 = 4. The calculator handles negative dividends with the mathematical convention, −7 mod 3 = 2 (because −7 = −3×3 + 2), and flags the programming convention (−1) so you can match your language. Evenness testing is the classic filter — n mod 2 = 0 means even, and 100 mod 7 = 2 shows how remainders detect non-divisibility. Congruence notation a ≡ b (mod m) appears too: 17 ≡ 2 (mod 5), the basis of modular arithmetic.

  1. 1

    Enter dividend and divisor

    Values like 17 and 5

  2. 2

    Divide and drop the quotient

    17 ÷ 5 = 3 remainder 2; only the remainder survives

  3. 3

    Read the remainder

    17 mod 5 = 2

  4. 4

    Interpret the congruence

    17 ≡ 2 (mod 5) links the result to clock-style arithmetic

Use Cases

Even/Odd Checks

n mod 2 = 0 gates alternating row colors and parity logic

Clock & Calendar

22 mod 12 = 10 pm; weekday cycles use mod 7

Hashing & Cycling

Array index wrap-around: i mod length

Tips

  • 1

    a mod b ∈ {0, 1, …, b−1} under the math convention

  • 2

    mod 2 = 0 tests even; mod 3 = 0 tests divisibility by three

  • 3

    Programming languages may return −1 for −7 mod 3; math says 2

Common Mistakes

  • Confusing the remainder with the quotient (3 vs 2 for 17 mod 5)

  • Expecting −7 mod 3 to be negative; mathematical result is +2

  • Computing 100 mod 7 as 14 — it is 2 (14×7 = 98)

  • Using modulo with a divisor of 0, which is undefined

FAQs

What is 17 mod 5?

2 — since 17 = 3×5 + 2.

What is −7 mod 3?

2 in mathematics (−7 = −3×3 + 2); many programming languages return −1.

How does modulo tell if a number is even?

n mod 2 = 0 ⇔ even. 86 mod 2 = 0, 87 mod 2 = 1.

What is 100 mod 7?

2, because 98 = 14×7 and 100 − 98 = 2.

Why is clock arithmetic modulo?

Hours cycle every 12: 22 mod 12 = 10, so 22:00 displays as 10.