Enter a dividend and a divisor to get the remainder of the division — the modulo — along with the quotient. It handles negative numbers carefully, showing the mathematical (floored) remainder and, when it differs, the truncated remainder that C and JavaScript produce. Large integers stay exact.
Enter a dividend and a non-zero divisor.
How it works
The modulo is what is left over after dividing evenly: 17 mod 5 is 2, because 17 = 5×3 + 2. The quotient is how many whole times the divisor fits (3 here) and the remainder is the leftover (2). The divisor cannot be zero, since division by zero is undefined.
Negatives are where conventions split. This tool’s main result is the floored (Euclidean) remainder, which always takes the sign of the divisor — so −17 mod 5 = 3, matching Python and most maths. When that differs from the truncated remainder used by C, Java and JavaScript (which keeps the dividend’s sign, giving −2), the tool shows both so there is no ambiguity. All arithmetic uses big integers, so very large numbers are exact.
Practical examples
Is a number even or odd?
Take the number mod 2. 4,821 mod 2 = 1, so it is odd; any result of 0 means even. The same idea checks divisibility by any number — mod 3 = 0 means divisible by 3.
Wrapping around a clock
5 hours after 22:00 on a 24-hour clock is (22 + 5) mod 24 = 3, i.e. 03:00. Modulo is how clocks, calendars and circular buffers wrap back to the start.
A negative dividend
−17 mod 5 gives 3 (floored), not −2. The tool shows the truncated −2 too, so you can match whichever language or textbook you are following.
Frequently asked questions
What does modulo mean?
It is the remainder after integer division. "a mod n" is what is left when a is divided by n as many whole times as possible. 20 mod 6 = 2, because 6 goes into 20 three times with 2 left over.
What is the difference between the remainder and the quotient?
The quotient is how many whole times the divisor fits into the dividend; the remainder is the amount left over. For 20 ÷ 6 the quotient is 3 and the remainder is 2.
Why do calculators disagree on negative modulo?
Two valid conventions exist. The floored version (Python, mathematics) gives a remainder with the divisor’s sign; the truncated version (C, Java, JavaScript) gives one with the dividend’s sign. −17 mod 5 is 3 floored but −2 truncated. This tool shows both.
Which convention does this tool use as the main answer?
The floored (Euclidean) one, where the remainder is always between 0 and the divisor’s size. It is the version taught in most maths courses and used by Python’s % operator.
Can the divisor be negative?
Yes. Under the floored convention the remainder then takes the divisor’s sign — 17 mod −5 = −3. The tool computes it correctly and shows the truncated alternative when they differ.
Why can’t the divisor be zero?
Because dividing by zero has no defined result, so there is no quotient or remainder. The tool asks for a non-zero divisor.
Does it work with decimals?
No. Modulo here is defined for whole numbers, so both inputs must be integers. Decimal "remainders" are a different operation and are not covered.
How large can the numbers be?
Effectively unlimited. The calculation uses big-integer arithmetic, so a dividend with dozens of digits still returns an exact remainder.
What is modulo used for in programming?
Wrapping indices around an array, alternating rows, hashing into buckets, checking divisibility, and cycling through states — anywhere a value should loop back after reaching a limit.
Are my numbers private?
Yes. Everything is computed in your browser; the values you enter are never uploaded or logged.
Related tools
GCD and LCM Calculator
Find the greatest common divisor and least common multiple of two or more whole numbers. Runs in your browser.
Math & education
Number Base Converter
Convert whole numbers between binary, octal, decimal and hexadecimal at once. BigInt-precise, in your browser.
Math & education
Prime Number Checker
Check whether a number is prime, with its prime factorisation and the nearest primes. Runs in your browser.
Math & education
Roman Numeral Converter
Convert Roman numerals to numbers and back, for values from 1 to 3999. Auto-detects the direction. Runs in your browser.
Math & education
Quadratic Equation Solver
Solve ax² + bx + c = 0 — real or complex roots, discriminant and vertex, with the steps. Runs in your browser.
Math & education
Exponent Calculator
Raise any base to any power — including negative and fractional exponents. Runs in your browser.
Math & education