Modulo Calculator

Find the non-negative remainder and integer quotient when one whole number is divided by another.

Calculations happen locally. We do not send your values to our server.

Example

Dividing 17 by 5 gives an integer quotient of 3 and a non-negative remainder of 2. For −17 divided by 5, the remainder is 3.

Calculation method

The calculator uses Euclidean division: dividend = divisor × quotient + remainder, where the remainder is at least zero and smaller than the absolute value of the divisor. Inputs are processed as exact whole numbers.

Important notes

The divisor cannot be zero. Negative inputs are supported, and very large integers remain exact because calculations use integer arithmetic rather than floating-point numbers.

Use the remainder for repeating positions

For a cycle with 7 positions numbered 0 through 6, position 17 wraps to position 3 because 17 = 7 × 2 + 3. A remainder of zero means exact divisibility. This is useful for repeating schedules, grouping and wrapping indexes; remember that a zero-based position of 0 is the first position, not the seventh.

Check both the quotient and remainder

The result follows dividend = divisor × quotient + remainder, with 0 ≤ remainder < |divisor|. Reconstruct the dividend using that identity to verify any result. Negative dividends and negative divisors are allowed. The examples show why the quotient changes to keep the remainder non-negative even when an input is negative.

Do not assume every programming operator agrees

Some programming languages define % as a signed remainder. For example, JavaScript evaluates -17 % 5 as -2, whereas this Euclidean calculator returns 3. Choose the convention required by your task before copying the result into code. Whole-number digits remain exact; decimal fractions and digit separators are not accepted.

Example · Calculation method
ExampleResult
17 ÷ 517 = 5 × 3 + 2
−17 ÷ 5−17 = 5 × (−4) + 3
17 ÷ (−5)17 = (−5) × (−3) + 2
−17 ÷ (−5)−17 = (−5) × 4 + 3
20 ÷ 520 = 5 × 4 + 0

MDN · Remainder (%)

Frequently asked questions

What is modulo used for?

Modulo is commonly used to test divisibility, wrap repeating sequences, alternate rows, group items, and find positions within cycles.

Why is the remainder non-negative for a negative dividend?

This tool uses the Euclidean convention, so the remainder is always between zero and the absolute divisor minus one. Programming languages may use a signed remainder operator with different behavior.

Can I enter decimal numbers?

No. Modulo and the accompanying quotient in this tool are defined for whole-number inputs. Enter integers without commas, spaces, or decimal points.

Related tools