MATH CALCULATOR
Modulo Calculator
Calculate the remainder after integer or decimal division using JavaScript's remainder operation.
How the modulo calculation works
The modulo operation returns the remainder left after division. For example, 17 divided by 5 leaves a remainder of 2, so 17 mod 5 = 2. For negative values, the result follows JavaScript’s remainder behavior rather than a universal mathematical modulo convention.
When to use this calculator
Use it for quick remainder checks in programming, number theory, divisibility work, and everyday calculations where you need to know what is left after division. Enter a non-zero divisor and verify the result before using it in another calculation.
Related calculators
Scientific · Percentage · Fraction
Modulo and remainders
The modulo operation returns the remainder after division. It is useful for repeating cycles, divisibility checks and integer-based programming logic.
Worked check
17 modulo 5 is 2 because 17 = 5 × 3 + 2. Always distinguish modulo from ordinary division: the quotient and remainder answer different questions.
Negative values
For negative operands, programming languages and mathematical conventions can differ in how a remainder is represented. Check the convention used when reproducing a result in software.
Modulo in practical calculations
Modulo gives the remainder after division. It is useful for repeating cycles, such as finding the position within a weekly schedule, checking whether a number is divisible by another number, or wrapping an index back to the start of a list.
Example with a cycle
If a process repeats every 7 steps, calculating 23 mod 7 gives 2. That means 23 is two positions beyond the nearest complete group of seven. The same idea can be applied to days, repeating machine cycles and array positions.
Negative inputs
Negative modulo results can differ between mathematical conventions and programming languages. If you are using a result in software, check the language's remainder/modulo definition rather than assuming every system handles negative values identically.
Modulo formula, remainder and worked checks
For integer division, the relationship is a = q × b + r, where q is the quotient and r is the remainder. In the usual non-negative integer setting with b positive, the remainder satisfies 0 ≤ r < b. For example, 23 = 3 × 7 + 2, so 23 mod 7 = 2.
Worked examples for cycles
For a 7-day repeating cycle, 23 steps leave a remainder of 2 after three complete groups of seven. For divisibility, 24 mod 6 = 0 means 24 is exactly divisible by 6. These examples use positive integers; fractional values are technically accepted by JavaScript’s remainder operator but are not the usual school-level modulo use case.
Negative values: a programming distinction
This page follows JavaScript’s remainder operator. Therefore, −17 % 5 returns −2 because the remainder keeps the dividend’s sign. Some mathematical modulo definitions instead return a non-negative result; under that convention, −17 mod 5 is 3. If you are reproducing results in code, use the same convention as the language or specification you need to match.
Step-by-step remainder checks
- Identify the dividend a and non-zero divisor b.
- Find the integer quotient q under the convention used by the calculator.
- Calculate the remainder r from a = q × b + r.
- Substitute q and r back into the equation to confirm the result.
For 29 divided by 6, the integer quotient is 4 and the remainder is 5, because 29 = 4 × 6 + 5. For 30 mod 6, the remainder is zero, so 30 is an exact multiple of 6. Modulo is useful for wrapping positions in a repeating list, checking divisibility, alternating patterns and clock arithmetic. In a seven-day cycle, adding seven days returns to the same weekday position.
Be careful when translating between programming languages and mathematics lessons. JavaScript’s % operator is a remainder operator, so a negative dividend can produce a negative remainder; other languages or mathematical definitions may normalize the result into a non-negative range. Decimal operands can also produce results that differ from the simple integer examples because binary floating-point cannot represent every decimal exactly. For school arithmetic, use integers unless the problem explicitly defines another convention, and never use a zero divisor.
Modulo calculator FAQs
What does a remainder of zero mean?
The dividend is exactly divisible by the divisor, so there is no leftover remainder.
Why is division by zero invalid?
A zero divisor does not define a finite quotient or remainder, so the calculator rejects it.
Is modulo the same as percentage?
No. Modulo returns a remainder; percentage expresses a ratio per hundred.