Modulo arithmetic is used in clocks, calendars, hashing, cryptography and check digits.
How to use the Modulo Calculator
- Dividend (a)
- Divisor (n)
Results update as you type, and every field accepts the units shown in its menu.
How it works
Divide a by n, take the floor of the quotient and subtract n times it from a.
Inputs explained
| Field | What to enter |
|---|---|
| Dividend (a) | A number |
| Divisor (n) | A number |
What each result means
- a mod n = mod([Dividend (a)], [Divisor (n)])
- Quotient (floor) = floor([Dividend (a)] ÷ [Divisor (n)])
- Exact division = [Dividend (a)] ÷ [Divisor (n)]
Example values
How the main result changes when Dividend changes and everything else stays at the example values above:
| Dividend (a) | a mod n |
|---|---|
| 62.5 | 6.5 |
| 93.75 | 2.75 |
| 125 | 6 |
| 156.25 | 2.25 |
| 187.5 | 5.5 |
| 250 | 5 |
Formula
a mod n = a − n × floor(a ÷ n)Worked example
Inputs — Dividend (a): 125; Divisor (n): 7.
Results — a mod n = 6; Quotient (floor) = 17; Exact division = 17.857143.
Key terms
- Remainder
- What is left after dividing as many whole times as possible.
Frequently asked questions
Why does −7 mod 3 give 2?
In mathematics the remainder takes the sign of the divisor; some programming languages return −1.
Can the divisor be zero?
No, division by zero is undefined.
What formula does the Modulo Calculator use?
a mod n = a − n × floor(a ÷ n).