Modulo Calculator
Find the remainder after dividing one number by another.
Find the remainder after dividing one number by another.
The Modulo Calculator finds the remainder left after one number is divided by another. Modulo operations appear in programming, repeating cycles, time calculations and elementary number theory.
The modulo operation, which returns the remainder after division, underlies everyday tasks like determining if a number is even or odd, converting between 24-hour and 12-hour clock time, and cycling through array indexes in programming.
For related tasks, try Random Number Generator, GCD Calculator or LCM Calculator.
The tool uses the remainder operation after division. The divisor must be non-zero. For negative numbers, the sign behavior follows JavaScript remainder semantics.
17 modulo 5 equals 2 because 17 = 5 × 3 + 2.
17 mod 5 equals 2, because 5 divides into 17 three times (15) with a remainder of 2; this same remainder concept is why the 17th hour on a 12-hour clock reads as 5 (17 mod 12 = 5).
Be careful with negative numbers, since different programming languages and calculators define the modulo of a negative number inconsistently; some return a negative remainder while others always return a non-negative one for the same input, so always check which convention a downstream tool or language uses.
Modulo gives what is left after dividing as many whole times as possible. 47 divided by 6 fits 7 times, using 42, so the remainder is 5. The result is always smaller than the divisor in size. When the remainder is zero, the first number is an exact multiple of the second, which makes modulo a quick test for divisibility. For example, a number is even if its remainder when divided by 2 is zero.
Modulo is the maths of things that repeat. A 24-hour time of 17:00 is 17 modulo 12, which is 5, so it is 5 pm. To find the weekday 100 days after a Monday, calculate 100 modulo 7, which is 2, so it is a Wednesday. Years follow modulo rules too: a year is a leap year if it is divisible by 4, except century years, which must be divisible by 400. So 2024 is a leap year, while 1900 is not because 1900 modulo 400 is 300.
Programmers use the remainder to wrap values around, such as cycling through a list of colours with index modulo list length, to alternate styles on odd and even rows, and to spread items into hash buckets. It is also used to split a total into units, for example finding the minutes left after converting seconds to hours. Remember that when the divisor is larger than the dividend, the remainder is simply the dividend.
This calculator uses the remainder operator, so the result takes the sign of the first number: minus 7 modulo 3 shows minus 1. Mathematicians often define modulo so that the result is never negative, which would give 2 for the same input. Different programming languages follow one convention or the other, so test before you rely on it. Decimals work too, such as 7.5 modulo 2, which is 1.5, but tiny rounding differences can appear with decimals.
Modulo answers how many are left over. If 53 students are split into groups of 6, there are 8 full groups and 53 modulo 6, which is 5, students left over. For rotating duties, such as a chore that moves between 5 people each day, day 23 belongs to person number 23 modulo 5, which is 3. Calendars, round-robin tournaments and shift patterns all use this idea. Whenever a pattern repeats after a fixed number of steps, the remainder tells you where you are in the cycle.
Modulo lets you find the day of the week without a calendar. In 2026, 1 January is a Thursday. To find the weekday of the 100th day of the year, take 100 minus 1, which is 99, and divide by 7. The remainder, 99 modulo 7, is 1, so the date is one day after Thursday, a Friday. That day is 10 April, since January, February and March together have 90 days. The method works for any number of days ahead: divide by 7 and use the remainder to count forward from the known weekday. It is the same idea that calendar programs use behind the scenes.
Modulo is the heart of many check digit systems that catch typing errors. The ten-digit ISBN uses weights from 10 down to 1, adds up the products and requires the total to be divisible by 11. For the number 0-306-40615-2, the sum is 0 plus 27 plus 0 plus 42 plus 24 plus 0 plus 24 plus 3 plus 10 plus 2, which is 132, and 132 modulo 11 is 0, so the number is valid. Credit card numbers use a different modulo 10 rule called the Luhn check. These checks cannot prove a number is correct, but they catch most single-digit mistakes and swapped digits.
When you convert a large quantity into mixed units, the remainder does the work. To turn 10,000 seconds into hours, minutes and seconds, divide by 3,600 to get 2 hours with a remainder of 2,800 seconds. Divide 2,800 by 60 to get 46 minutes with a remainder of 40 seconds. So 10,000 seconds is 2 hours, 46 minutes and 40 seconds. The same approach converts centimetres into metres and centimetres, or a large number of items into boxes and loose items. Whenever you need to split a total into groups and a leftover, think quotient and remainder.
Programmers use modulo to cycle through lists, to alternate between styles, to distribute items across servers and to keep numbers inside a range. Be careful with negative numbers: this calculator, like many programming languages, gives the remainder the sign of the first number, so minus 7 modulo 3 is minus 1, while a mathematical modulo gives 2. Dividing by zero is not allowed. Decimals can produce tiny rounding differences. In loops, using modulo with a power of two can be replaced by a faster bit operation, but readability usually matters more than speed. Always test with edge cases such as zero and negative values.
The dividend is the number being divided and the divisor is the number you divide by. The quotient is the whole number of times the divisor fits, and the remainder is what is left. The modulus is the divisor in modular arithmetic. Two numbers are congruent modulo n if they have the same remainder when divided by n. Parity means whether a number is even or odd. Wrap-around describes values that return to the start after reaching a limit, like hours on a clock.
A number equals the quotient times the divisor plus the remainder. A number is even if its remainder modulo 2 is zero, and its remainder modulo 10 is its last digit. To move forward on a weekly cycle, use the remainder modulo 7. Remainders of sums follow the rule that the remainder of a sum equals the remainder of the sum of the remainders. Remember that negative numbers may give a negative remainder in some tools, so check the convention.
They are closely related; for positive inputs this tool gives the familiar division remainder.
No. Division by zero is undefined.
Yes, although modulo is most commonly used with integers.
Division tells you how many whole times one number fits into another, while modulo tells you what is left over after that whole-number division is performed.
Yes, since 0 divided by any non-zero number leaves no remainder; the modulo of 0 by anything is always 0.