A walkthrough, end to end.
- 1
Enter the dividend a and modulus n.
- 2
See both the math-style modulo (always 0..n−1) and the programmer-style remainder.
- 3
Quotient is shown alongside.
Modulo arithmetic
a mod n returns the remainder when a is divided by n. Math convention keeps the result non-negative; programming languages usually take the sign of a.
What you can do with this.
Cyclic counters
Wrap an index around a buffer of size n: i mod n.
Cryptography
Modular arithmetic underpins RSA and other crypto.
Day of week
Add days mod 7 to find the resulting weekday.
Hash bucket index
Map keys into n buckets via hash mod n.
Negative dividend handling
See the difference between math and programmer mod for −7 mod 3.
Discrete math homework
Verify modular arithmetic by hand.
Time-of-day math
Wrap hours around the 24-hour clock.
Modulo 2026 — what's current
Foundational; calculator wins for clear sign-handling.
Frequently asked.
Math mod is always 0 ≤ r < |n|. Programmer mod takes sign of a (so −7 mod 3 = −1 in C, but +2 in math).
Undefined — modulus must be non-zero.
Inputs treated as integers. For floats, use the basic calculator.
No. All math runs in your browser.