Remainder Calculator

Enter two numbers to find the remainder left over after division.

How it is calculated

The tool computes the remainder as r = dividend − divisor × ⌊dividend / divisor⌋, where ⌊ ⌋ rounds down to a whole number. It shows r first and the whole-number quotient second. Both inputs must be whole numbers: a decimal such as 59.5 gives no result, and so does a divisor of zero or a number beyond about 9 quadrillion (253). With positive numbers the remainder is always from 0 up to divisor − 1, and a remainder of 0 means the divisor divides the dividend evenly. Because the quotient is rounded down, the remainder takes the sign of the divisor: −3 mod 7 gives 4 with quotient −1, and 3 divided by −7 gives a remainder of −4. Many programming languages instead give −3 for −3 % 7, so the results can differ.

Worked example

Today is a given weekday; which weekday is it 59 days later? Weekdays repeat every 7 days, so divide 59 by 7. Step 1: 7 × 8 = 56, which is the largest multiple of 7 not above 59, so the quotient is 8. Step 2: 59 − 56 = 3. The tool prints a remainder of 3 and a quotient of 8. So 59 days later is the same as 3 days later: three weekdays forward.

Try this example →

Common mistakes

  • Reading the quotient as the answer when you need the remainder. The remainder is listed first; the quotient is the number of complete groups.
  • Expecting a negative remainder from a negative dividend. Here −3 ÷ 7 gives remainder 4, since the quotient rounds down to −1.
  • Entering a decimal, such as 8.43 for 59 / 7, or a decimal dividend. The tool shows no result; the remainder is the leftover whole amount, 3, not the fractional part.
  • Swapping dividend and divisor. 4 divided by 9 has remainder 4, but 9 divided by 4 has remainder 1.
  • Comparing with a programming language and assuming a mismatch is a bug. For negative numbers many languages truncate the quotient instead of rounding it down, so the signs of the remainder differ.

About this calculator

Dividing one integer by another produces a quotient and a leftover amount, the remainder, that doesn’t divide evenly; this is the same operation programmers call the modulo (often written a % b), and it’s formally defined by the division algorithm a = b × q + r, where r is the remainder and, for positive integers, is always non-negative and smaller than b.

Programmers use the modulo operation constantly — to check whether a number is even or odd, to wrap array indices or clock values around a fixed range, to distribute items cyclically across buckets in hashing, or to control looping patterns in animations and games. Students also use remainders directly in long division, in scheduling problems, such as which day of the week falls a set number of days from today, and in basic number theory topics like divisibility rules and modular arithmetic.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators