Modulo Calculator (a mod n)
a mod n: remainder of a divided by n. Always non-negative for positive n.
Result
How to use this calculator
- Enter a and n.
- Read mathematical mod (always 0..n−1) and JS-style mod (signed).
About this calculator
Modulo (a mod n) returns the remainder when a is divided by n. For positive operands: 17 mod 5 = 2 (since 17 = 3 × 5 + 2). For negative dividends, conventions differ: math mod is always non-negative (−7 mod 5 = 3); programmer's remainder follows sign of dividend (-7 % 5 = -2 in JS/C/Java). Used in cryptography, hashing, cyclic structures (clocks, calendars), and array indexing.
Frequently asked
Why two answers?+
When does the difference matter?+
Modular arithmetic use?+
a mod 0?+
Modular inverse?+
Related calculators
More tools you might like
Hand-picked tools that pair well with this one — same audience, same intent.
Euclidean algorithm: gcd(a,b) = gcd(b, a mod b). Supports 2-6 integers.
lcm(a,b) = |a × b| / gcd(a,b). Smallest number that both a and b divide evenly.
Is n prime? Trial division up to √n; identifies smallest divisor and nearest primes if composite.
Convert decimal ↔ scientific notation. Standard form a × 10^b with 1 ≤ |a| < 10.
Convert any integer between binary (2), octal (8), decimal (10), and hexadecimal (16).
Maximum-compression PDF squeeze — re-rasters every page as a JPEG. Big size reduction, but the text becomes non-selectable.