Share this free calculator
Send this tool to someone who needs the calculation.
How to use
Remainder conventions can differ for negative integers. The calculator therefore shows both truncating programming-style remainder and non-negative Euclidean modulo.
- Enter integer dividend a and divisor b.
- The divisor must not be zero.
- Compare programming and Euclidean remainders and verify a=bq+r.
How it is calculated
Example
17 mod 5 is 2 under both conventions. For −17 and 5, truncating remainder is −2 while Euclidean modulo is 3.
Important notes
Inputs are parsed as integer strings and computed with BigInt so integers larger than JavaScript’s safe-number range remain exact.
Worked examples and interpreting results
Dividing 17 by 5 gives integer quotient 3 and remainder 2. Negative inputs can produce different remainders under different conventions; the Euclidean remainder of −17 with divisor 5 is 3.
| Case | Calculation | Result |
|---|---|---|
| Remainder of 17 divided by 5 | 17 = 5 × 3 + 2 | 2 |
| Euclidean remainder of −17 divided by 5 | −17 = 5 × (−4) + 3 | 3 |
How to check the result
Check dividend = divisor times quotient plus remainder. The Euclidean remainder is nonnegative and smaller than the divisor’s absolute value. Use integers and a nonzero divisor.
Frequently asked questions
What is the difference between modulo and remainder?
They usually agree for non-negative integers; negative operands expose the convention difference.
Does it support integers above 2^53?
Yes, integer arithmetic uses BigInt.
Can the divisor be zero?
No.
Why can negative remainders differ between tools?
Different conventions define division remainder when an operand is negative. Some programming languages follow the dividend’s sign while others return a non-negative modulo, so check the convention before comparing results.