Free tool

Remainder and modulo calculator, with the steps.

Type a dividend and a divisor to get the quotient and the remainder (the modulo). For negative numbers the page shows the two common rules side by side, the truncated one used by JavaScript and the floored one used by Python, plus the Euclidean one, so you can see which answer your code or class expects. It also gives the decimal answer, works with decimals, and writes out the long division. Extras for big whole numbers: a power mod n, and the inverse of a number mod n.

Whole numbers or decimals for a division, up to 60 digits. Power and inverse use whole numbers.

Worked out in your browser. Nothing is sent anywhere.

The maths

What is left after dividing.

01 / Quotient

How many times it fits

The whole number of times the divisor fits into the dividend.

02 / Remainder

What is left over

The dividend minus divisor times quotient. It is the modulo of the two numbers.

03 / Check

Put it back together

Divisor × quotient + remainder always gives the dividend back.

Guide

How to find a remainder, with worked examples.

A remainder calculator divides one whole number by another and tells you the quotient, which is how many times the divisor fits, and the remainder, which is what is left over. The remainder is also called the modulo, and the operation is written a mod b. This page shows the answer under each common rule for negative numbers, writes out the long division, and has extras for modular arithmetic with big numbers.

How to use the remainder calculator

  1. Type the number to divide in Dividend and the number to divide by in Divisor.
  2. Read the big card: the quotient and the remainder, with the check that divisor × quotient + remainder gives back the dividend.
  3. Check the cards under it for the decimal answer and the mixed number, and open Which rule is which and the long division for the working.
  4. For a power or an inverse, change What to work out, then fill in the extra boxes.
  5. Use Copy result to copy the answer, or Copy link to share it.

A worked example

Divide 17 by 5. The number 5 fits into 17 three times, since 3 × 5 = 15, and 17 − 15 = 2 is left. So the quotient is 3 and the remainder is 2, and you can check it: 5 × 3 + 2 = 17. As a decimal, 17 ÷ 5 = 3.4, and as a mixed number it is 3 2/5, because the remainder 2 sits over the divisor 5. The remainder is always smaller than the divisor.

Negative numbers: three rules

When one number is negative, there is more than one sensible answer, and programming languages differ. The truncated rule cuts the quotient towards zero, and the remainder takes the sign of the dividend. The floored rule rounds the quotient down, and the remainder takes the sign of the divisor. The Euclidean rule keeps the remainder at 0 or more.

DivisionTruncatedFlooredEuclidean
−17 ÷ 5q −3, r −2q −4, r 3q −4, r 3
17 ÷ −5q −3, r 2q −4, r −3q −3, r 2
−17 ÷ −5q 3, r −2q 3, r −2q 4, r 3

Each row still obeys the check. Take −17 ÷ 5 under the truncated rule: 5 × (−3) + (−2) = −17. Under the floored rule: 5 × (−4) + 3 = −17.

Which one do you need? JavaScript's % follows the truncated rule: MDN says the result takes the sign of the dividend, so -13 % 5 is −3 there. Python's % follows the floored rule: its reference says the result has the same sign as the second operand. Excel's MOD also takes the sign of the divisor, as Microsoft's MOD page shows. All three pages were checked on 18 Oct 2026. For a clock or an array index that wraps round, you usually want a result of 0 or more, which the floored and Euclidean rules give when the divisor is positive.

Decimals

The calculator also works with decimals. 7.5 mod 2 is 1.5, because 2 fits into 7.5 three times (6) and 1.5 is left. The quotient stays a whole number and the remainder can have decimals. Internally the page scales both numbers to whole numbers, so there is no floating point rounding.

Long division

For whole numbers, open the long division box. It shows the school layout and a sentence for each step: bring down a digit, see how many times the divisor fits, multiply, subtract. It is shown for the sizes of the numbers, and the signs are applied by the rule you picked.

Power mod n and inverse mod n

These are the building blocks of modular arithmetic, used in clocks, checksums and cryptography. The power ab mod n would be a huge number if you worked out the power first, so the page uses square and multiply and reduces mod n at each step. For example 413 mod 497 is 445. The inverse of a mod n is the number x with a × x mod n = 1. It exists only when a and n share no factor but 1. The inverse of 3 mod 11 is 4, since 3 × 4 = 12 and 12 mod 11 = 1. The page finds it with the extended Euclidean algorithm and shows the table. For 6 mod 9 there is no inverse, because 6 and 9 share the factor 3.

Common problems

  • The remainder is negative: this is the truncated rule. Look at the floored or Euclidean card if you need 0 or more.
  • The divisor is 0: there is no answer, so the page says so.
  • A comma in a number is removed, so 1,234 is read as 1234.

To split a number into primes first, try the factor calculator. For the greatest common factor and least common multiple, use the GCF and LCM calculator, and for fractions the fraction calculator.

Questions

Good to know.

How do you find the remainder of a division?

Divide, keep the whole number part as the quotient, then subtract divisor × quotient from the dividend. 17 ÷ 5 has quotient 3, and 17 − 15 = 2 is the remainder.

What is modulo?

Modulo, written mod, is the remainder after division. 17 mod 5 = 2. It is often used for things that repeat, such as hours on a clock.

What is the difference between remainder and modulo?

For positive numbers they are the same. For negative numbers, some languages return a remainder that follows the dividend and others a modulo that follows the divisor. The page shows both.

Why is my remainder negative in JavaScript?

JavaScript's % takes the sign of the dividend, so -17 % 5 is -2. To get 3, use ((n % d) + d) % d.

How do I get Python's answer?

Look at the floored card. Python's % takes the sign of the divisor, so -17 % 5 is 3.

What if the dividend is smaller than the divisor?

The quotient is 0 and the remainder is the dividend. 3 mod 5 = 3.

Can the remainder be a decimal?

If you type decimals, yes: 7.5 mod 2 = 1.5. With whole numbers, the remainder is a whole number, and the decimal answer to the division is shown separately.

What does a mod n mean in cryptography?

It means working with remainders after dividing by n, so numbers wrap round. Power mod n and the inverse mod n are the main operations, and the extras here do both for big numbers.

Is anything sent anywhere?

No. Everything is worked out in your browser.