Modulo Calculator: inspect an exact integer result
Calculate a nonnegative residue and matching quotient for signed integers with a positive modulus. Enter the labeled integer fields and choose Calculate. Load example (replaces inputs) supplies a reproducible case; it clears any earlier result.
Work through the example
For number -17 and modulus 5, residue is 3 and quotient is -4. The identity is -17 = (-4 × 5) + 3.
Calculation convention
The result follows a nonnegative-residue convention. It can differ from a programming language remainder operator on negative inputs: -17 % 5 can produce -2 in some languages, while this tool returns 3. The displayed quotient satisfies number = quotient × modulus + residue.
Supported inputs and limitations
The modulus must be positive; modulus one always returns residue zero. Signed integers with at most 30 digits are accepted, with optional surrounding whitespace. Decimals, exponent notation and grouping separators are rejected. Calculations use exact BigInt arithmetic rather than floating-point division.
If you are comparing this result with code, check how that language defines remainder for negative operands. Both -2 and 3 are congruent modulo 5, but this calculator deliberately displays 3. Copy results includes the quotient as well as the residue, allowing you to check the reconstruction identity.
Use Modular Inverse Calculator for a multiplicative inverse modulo an integer, or Greatest Common Divisor Calculator to inspect coprimality.





