Modular Arithmetic Calculator – Mod Operations
This calculator computes (a op b) mod m: (7+9) mod 12 = 4, 5×5 mod 12 = 1, 17 ≡ 5 (mod 12).
- Addition, multiplication, powers and inverses mod m.
Figures are estimates from this calculator’s standard formula — adjust the inputs in the tool below for your exact number.
How the Modular Arithmetic Calculator Works
Modular arithmetic wraps results around a modulus m, keeping only remainders. Adding 7 + 9 hours on a 12-hour clock gives 16 mod 12 = 4 — 4 o’clock. Multiplication wraps the same way: 5×5 = 25 mod 12 = 1, so 5 is its own inverse modulo 12. The calculator supports +, −, × and powers mod m, reducing after every operation so intermediate values stay small — computing 3⁴ mod 5 as successive reductions (3² = 9 ≡ 4, then 4² = 16 ≡ 1) rather than 81 first. Congruence testing checks whether m divides the difference: 17 ≡ 5 (mod 12) because 12 | 12. Negative operands normalize into [0, m), so −7 mod 12 = 5. This system powers RSA encryption (exponentiation mod huge semiprimes), hash functions, cyclic schedules, and music theory’s 12 semitone clock.
- 1
Choose the modulus m
12 for clock math, 7 for weekdays, 2 for parity
- 2
Enter operands and operator
a and b with +, −, ×, or power
- 3
Reduce at every step
Intermediate results are wrapped mod m immediately
- 4
Read the congruence
The a ≡ r (mod m) statement is displayed
Use Cases
Cryptography
RSA relies on powers mod semiprimes like 3233 = 61×53
Scheduling Cycles
Weekday arithmetic: day 47 ≡ 5 (mod 7)
Checksums
ISBN and IBAN digits verify via weighted sums mod 10
Tips
- 1
Reduce early, reduce often — values never need to exceed m²
- 2
a ≡ b (mod m) means m divides the difference a−b
- 3
Inverses exist only when gcd(a, m) = 1
Common Mistakes
Reducing only the final result and overflowing intermediate powers
Assuming subtraction never goes negative — wrap with +m
Dividing in modular arithmetic as if rationals were allowed
Expecting an inverse for non-coprime pairs: 4 has none mod 8
FAQs
What is (7+9) mod 12?
What is 5×5 mod 12?
How do I compute 3⁴ mod 5 efficiently?
What does 17 ≡ 5 (mod 12) mean?
When does a⁻¹ exist mod m?
Related tools
Pick another tool to continue your calculation.
Modular Inverse Calculator – a⁻¹ mod m
Calculate the modular inverse of a number.
Riemann Sum Calculator – Left, Right & Midpoint
Calculate approximate integral using Riemann sum.
Signed Magnitude Converter – 8-Bit Binary
Convert between decimal and binary signed magnitude.
Divisor Sum Calculator – σ(n) Function
Calculate sum of divisors and Euler functions.
Stirling’s Approximation Calculator – n! Estimate
Calculate factorial using Stirling's approximation.
Euler-Mascheroni Constant γ Calculator
Calculate the Euler-Mascheroni constant gamma to high precision.