About this tool
Enter a and n to compute a mod n. It shows both the JavaScript remainder (whose sign follows a) and the mathematical modulo (always non-negative), the quotient, and whether a is divisible by n. It uses BigInt so very large integers and negatives are exact — all in your browser.
Frequently asked questions
Why are there two modulo results?
JavaScript's % operator keeps the sign of the dividend, so -7 % 5 is -2, while the mathematical modulo is always non-negative, giving 3. Both are shown.
Does it handle very large numbers?
Yes. Inputs are parsed as BigInt, so arbitrarily large integers and negatives are handled exactly without rounding.