Find the non-negative remainder and integer quotient when one whole number is divided by another.
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| Example | Result |
|---|
17 ÷ 5 | 17 = 5 × 3 + 2 |
−17 ÷ 5 | −17 = 5 × (−4) + 3 |
17 ÷ (−5) | 17 = (−5) × (−3) + 2 |
−17 ÷ (−5) | −17 = (−5) × 4 + 3 |
20 ÷ 5 | 20 = 5 × 4 + 0 |
MDN · Remainder (%)