Calculators

Modulo Calculator

Find a mod b, the remainder after dividing a by b. Shows the quotient and the steps.

Modulo Calculator

Finds the remainder of a ÷ b.

17 mod 5 = 2 17 = 3 × 5 + 2, so the remainder is 2.

What This Calculator Does

Modulo is just the remainder after division. 17 mod 517 \bmod 5 asks “divide 17 by 5 - what is left over?” Since 5 goes into 17 three times (15), with 2 to spare, 17 mod 5=217 \bmod 5 = 2.

It is how clocks work: 15 o’clock is 3 PM because 15 mod 12=315 \bmod 12 = 3. Programmers reach for it constantly - to check if a number is even (n mod 2n \bmod 2), to wrap a value around, or to sort things into a fixed number of buckets.

How It Works

a mod b=a−b⌊ab⌋a \bmod b = a - b \left\lfloor \frac{a}{b} \right\rfloor

How to Use It

  1. Enter the dividend a and the divisor b.
  2. Read the remainder.

Worked Examples

aba mod b
1752
10072
2480
941

FAQ

What is the modulo operation?

It returns the remainder of a division. 17 mod 5=217 \bmod 5 = 2, because 5 goes into 17 three times with 2 left over.

What is modulo used for?

Clock and cyclic arithmetic, checking whether a number is even or odd (n mod 2n \bmod 2), and looping through a fixed set of items.

How are negative numbers handled?

The result follows the sign of the dividend a, as it does in most programming languages.

Save this setup

Keep these values in this browser. Open saved setups from My tools.