How it works
Euclidean modulo returns r with 0 ≤ r < modulus, so dividend = floor quotient × modulus + r.
The modulus must be positive. Some programming languages use a remainder with the dividend’s sign; that value is shown separately to make the convention clear.
Worked example
−17 mod 5 is 3 as a Euclidean remainder, because −17 = −4 × 5 + 3; truncated division, as used by the % operator in C and JavaScript, gives −2 instead.
How the euclidean remainder changes with integer dividend
Other inputs keep their starting values: Positive integer modulus: 5. Examples only, not recommendations.
| Integer dividend | Euclidean remainder |
|---|---|
| -17 | 3 |
| -34 | 1 |
Cite this page
ToolOctopus. “Modulo calculator.” Updated . https://tooloctopus.com/modulo-calculator.
Add an access date if your instructions require one.
Citation formatting uses citeproc-js by Frank Bennett and Citation Style Language styles. License and source code.