Remainder & Modulo Calculator

When one whole number does not divide another exactly, the amount left over is the remainder. In maths and programming this is also called the modulo, written a mod b. This calculator gives the quotient and remainder, handles negative numbers with a non-negative remainder, and lists which numbers from 2 to 12 divide the dividend.

Try:

How to use the remainder & modulo calculator

  1. Enter the dividend a (the number being divided).
  2. Enter the divisor b.
  3. Press Calculate to see a = b × q + r.

Formula

a=bq+r,0≤r<∣b∣a = bq + r,\quad 0 \le r < |b|

Worked example: 157 ÷ 12

  • Dividend a: 157
  • Divisor b: 12

✓ Answer checked

157=12×13+1157 = 12 \times 13 + 1
Quotient
13
Remainder (a mod b)
1
157 is divisible by
none of 2–12
Step-by-step working (2 steps)
  1. Divide

    How many whole times does 12 fit into 157?

    quotient=13\text{quotient} = 13
  2. Find what is left a = bq + r, 0 ≤ r < |b|

    The remainder is always between 0 and |b| − 1.

    157−12×13=1157 - 12 \times 13 = 1
How this was checked
  • ✓ 12 × 13 + 1 = 157, with 0 ≤ 1 < 12.

For negative numbers the remainder is taken as non-negative (the mathematical "mod").

Frequently asked questions

What is 157 divided by 12 with remainder?

13 remainder 1, because 12 × 13 = 156.

What is −17 mod 5?

3, because −17 = 5 × (−4) + 3. Some programming languages return −2 instead.

What does 'divisible' mean?

The remainder is 0, so the division is exact.

Related calculators

Related guides