mod

Remainder & Modulo Calculator

Arithmetic & NumbersFreeStep by step

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,\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").

When to use the Remainder & Modulo Calculator

  • Find what's left over when sharing items into equal groups.
  • Check whether a number is divisible: remainder 0 means it is.
  • Work out days of the week and clock arithmetic.
  • Use the modulo (%) operator in programming.

Quick facts to remember

  • Dividend = divisor × quotient + remainder.
  • The remainder is always less than the divisor.
  • Remainder 0 means the divisor is a factor.
  • In code, 17 % 5 = 2.

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.

People also search for

remainder calculatormodulo calculatormod calculatorquotient and remainderremainder & modulo calculator with stepsfree remainder & modulo calculator online

🔗 Embed this on your website or blog — free

Teachers and bloggers: copy this code and paste it into your page (use an HTML or "Custom HTML" block). It always stays up to date.