How to Calculate Modulo
Find the remainder when dividing two integers.
The Formula
a mod b = rThe modulo formula uses the mathematical relationship: a mod b = r. Each variable in the formula represents a measurable quantity that affects the final result.
What Each Variable Means
Every value in the modulo formula, what it measures, and the value used in the worked example on this page:
| Variable | Type | Example value |
|---|---|---|
| Dividend (a) | Input (you provide) | 17 |
| Divisor (b) | Input (you provide) | 5 |
| Quotient | Result (calculated) | — |
| Remainder (a mod b) | Result (calculated) | — |
Step-by-Step Method
- 1Write down the values you know: Dividend (a), Divisor (b).
- 2Substitute your known values into the formula: a mod b = r.
- 3Work through the arithmetic in the standard order of operations — parentheses first, then exponents, then multiplication and division, then addition and subtraction.
- 4Check that your result carries the correct unit and falls in a reasonable range for the problem.
- 5Verify your answer with the interactive Modulo Calculator — it solves the same formula instantly.
Worked Example
Take a concrete case: dividend (a) = 9, with the other inputs at the typical values from the variables table above. Substituting into the formula gives quotient = 1, remainder (a mod b) = 4. These numbers are solved by the same engine that powers the Modulo calculator, so you can reproduce them exactly by entering the same inputs there.
| Dividend (a) | Quotient | Remainder (a mod b) |
|---|---|---|
| 4 | 0 | 4 |
| 9 | 1 | 4 |
| 10 | 2 | 0 |
| 20 | 4 | 0 |
| 30 | 6 | 0 |
| 40 | 8 | 0 |
| 50 | 10 | 0 |
| 70 | 14 | 0 |
How each result changes as dividend (a) changes, holding the other inputs constant.
Practice Problems
1. 17 mod 5 = 2: Given Dividend (a) 17, Divisor (b) 5, what does it come out to?
Answer: Entering Dividend (a) 17, Divisor (b) 5 gives Quotient 3, Remainder (a mod b) 2.
2. You enter Dividend (a) 125, Divisor (b) 7 — what does the calculator return?
Answer: The calculator returns Quotient 17, Remainder (a mod b) 6 for Dividend (a) 125, Divisor (b) 7.
Frequently Asked Questions
What is the formula for modulo?
The formula is: a mod b = r. Find the remainder when dividing two integers.
What values do I need to calculate modulo?
You need dividend (a), divisor (b). The calculator produces quotient, remainder (a mod b) from those inputs.
What is the modulo when dividend (a) is 9?
With dividend (a) = 9, the result is quotient = 1, remainder (a mod b) = 4. This is worked through in full in the example on this page.
Related Topics
Use the Interactive Calculator
Skip the manual math — get instant results with our free Modulo calculator.
