About the Remainder Calculator
When one number does not divide another exactly, what is left over is the remainder. Divide 1734 by 13 and you get 133 with 5 left — the 5 is the remainder.
That sounds like a loose end, something the division failed to tidy up. It is the opposite. The remainder is often the answer you actually want. How many full boxes of 12 can you pack, and how many items are left loose? What day of the week is it in 100 days? Is this number even? All of these are remainder questions, and none of them care about the quotient.
The remainder operation is usually written mod, and it underpins a surprisingly large amount of real machinery: clock arithmetic, checksums, hash tables, and the public-key cryptography that secures the connection you are reading this over.
This calculator finds remainders, checks divisibility with the standard digit shortcuts, and computes large powers modulo a number — the operation at the heart of RSA.
How to Use the Remainder Calculator
Remainder of a division takes two whole numbers. If the first is negative, pick a convention — see below, because this is the one genuinely contested corner of the subject.
Check divisibility answers yes or no, and explains the shortcut for that divisor where one exists. For 3 it will show you the digit sum; for 11, the alternating sum.
Power modulo n computes bᵉ mod n. The exponent can be astronomically large, because the calculation never builds the full power — see the method below.
Press Calculate. Every mode shows the working, and the remainder mode includes the multiply-back check.
How Remainders Are Calculated
The defining relationship:
dividend = quotient x divisor + remainder
Find how many whole times the divisor fits, subtract that much, and what is left is the remainder. For it to be a proper remainder, it must be smaller in magnitude than the divisor — otherwise the divisor fits at least once more.
For positive numbers that is the whole story. For negative dividends there are two defensible answers, and the world is genuinely split.
Take −17 ÷ 5. Both of these satisfy the identity above:
-3 remainder -2 -> -3 x 5 + (-2) = -17 truncated
-4 remainder 3 -> -4 x 5 + 3 = -17 Euclidean
The difference is how the division rounds. Truncating toward zero gives a quotient of −3 and a negative remainder. Flooring — rounding down — gives −4 and a non-negative remainder.
Most programming languages truncate, so -17 % 5 returns −2 in C, Java, JavaScript and Rust. Mathematical convention usually floors, keeping the remainder non-negative, and Python follows it: -17 % 5 is 3.
Neither is wrong. This calculator offers both and tells you what the other one would have given, because the most common reason to look this up is that code and theory disagreed and you need to know which convention each was using.
Remainder Formula
Euclidean (remainder always non-negative):
r = a - n x floor(a / n) 0 <= r < |n|
Truncated (sign follows the dividend):
r = a - n x trunc(a / n)
Modular exponentiation, by repeated squaring:
b^e mod n computed in about log2(e) steps
Divisibility shortcuts worth knowing, all of which this calculator explains as it applies them:
2 last digit is even
3 digits sum to a multiple of 3
4 last two digits form a multiple of 4
5 last digit is 0 or 5
6 passes both the 2 and the 3 test
8 last three digits form a multiple of 8
9 digits sum to a multiple of 9
10 ends in 0
11 alternating digit sum is a multiple of 11
The digit-sum rules work because 10 leaves a remainder of 1 when divided by 3 or 9, so every power of ten does too — which means a number is congruent to its own digit sum. The rule for 11 alternates because 10 ≡ −1 (mod 11), so successive powers alternate between +1 and −1.
Step-by-Step Example
Find the remainder when 1734 is divided by 13.
Step 1 — how many whole times? 13 × 133 = 1729, and 13 × 134 = 1742, which is too big. So 133.
Step 2 — subtract. 1734 − 1729 = 5.
Step 3 — check. 133 × 13 + 5 = 1734. ✓
Now the case that makes this calculator worth having. Compute 7²²² mod 13.
The naive approach is to work out 7²²², which has 188 digits, and then divide. That is both slow and unnecessary. Instead, reduce at every step:
Step 1: 7² = 49 ≡ 10 (mod 13)
Step 2: 7⁴ ≡ 10² = 100 ≡ 9
Step 3: 7⁸ ≡ 9² = 81 ≡ 3
Step 4: 7¹⁶ ≡ 3² = 9
...
Each squaring doubles the exponent, so 222 is reached in about eight steps rather than 222 multiplications, and no intermediate value ever exceeds 169.
The answer is 12. You can verify it another way: 7 has order 12 modulo 13, meaning 7¹² ≡ 1. Since 222 = 18 × 12 + 6, we get 7²²² ≡ 7⁶ ≡ 12.
This method is not an optimisation, it is an enabler. RSA raises numbers to exponents with hundreds of digits. Forming that power is physically impossible; squaring and reducing takes microseconds.
Understanding Your Result
In remainder mode the answer is what is left over. The detail line restates the full division identity so you can see it reconcile, and the check line tells you what the other convention would have given when the dividend is negative.
In divisibility mode you get a plain yes or no, plus the shortcut for that divisor. The shortcut is the part worth reading — it is how you check the same thing next time without a calculator.
In power mode the answer is the residue, along with how many squarings were needed. For an exponent of a billion it is about thirty, which is the whole point.
A remainder is always smaller than the divisor. If yours is not, something has gone wrong — most likely the quotient was too small by one.
When Should You Use This Calculator?
Grouping and packing. Full boxes and leftovers, complete teams and spare players, whole weeks and remaining days.
Cyclic problems. What day of the week, what position in a rotation, where a repeating pattern lands. Anything that wraps around is modular arithmetic — a clock face is arithmetic modulo 12.
Checking divisibility. Simplifying fractions, finding factors, testing primality by trial division.
Programming. Even-odd tests, wrapping array indices, hash bucket selection, and above all reconciling a language's % with mathematical expectations when negatives are involved.
Check digits. ISBNs, IBANs, credit card numbers and barcodes all use a modular checksum to catch transcription errors.
Cryptography. Modular exponentiation is the core operation in RSA and Diffie–Hellman. The power mode does at small scale exactly what those do at large scale.
Common Mistakes
Assuming every language agrees on negatives. They do not. Check whether yours truncates or floors before relying on % with a negative dividend, especially when wrapping an index — a negative remainder there is an out-of-bounds access.
Confusing the remainder with a decimal. "133 remainder 5" is not 133.5. The remainder is 5 out of 13, which as a decimal is 0.3846…
Forgetting the remainder must be smaller than the divisor. A remainder of 17 when dividing by 5 means the quotient was three too low.
Reading a remainder of zero as a failure. Zero is the informative case: it means the division was exact.
Computing the full power before reducing. For b^e mod n, reduce at every step. Building the power first is usually impossible and never necessary.
Applying divisibility shortcuts to the wrong divisor. The digit-sum rule works for 3 and 9. It does not work for 7, which has no simple digit rule — which is exactly why 7 is the awkward one here too.
Assuming mod always means the same as remainder. For positive numbers they coincide. For negatives, "mod" in mathematics usually implies the non-negative result, while the % operator usually does not.