Modulo Calculator
Calculate the remainder of division (modulo operation). Supports positive and negative numbers and shows the full division breakdown.
Did this tool work for you?
How to use this calculator
The modulo operation returns the remainder when a is divided by m.
- 1
Enter the dividend (number being divided).
- 2
Enter the modulus (divisor).
- 3
The result is the remainder after floor division.
- 4
Note: for negative numbers, mathematical modulo differs from the % operator in most languages.
Frequently asked questions
What is modulo used for in programming?
Checking even/odd (n % 2 === 0), wrapping array indices (index % length), cycling through values (counter % 7 for day of week), and hashing (key % table_size). It is one of the most frequently used operations in software development.
Why does -7 mod 3 differ from (-7) % 3 in JavaScript?
Mathematical modulo always returns a non-negative result when the modulus is positive: -7 mod 3 = 2 (because -7 = 3 × (-3) + 2). JavaScript's % operator follows the sign of the dividend: (-7) % 3 = -1. Python uses mathematical modulo; C, Java, and JS use truncating division.
What is modular arithmetic?
Modular arithmetic ("clock arithmetic") wraps numbers around a modulus. On a 12-hour clock, 10 + 5 = 3 (not 15), because 15 mod 12 = 3. It is foundational in cryptography (RSA, Diffie-Hellman), hashing, and cyclic data structures.
What is the difference between remainder and modulo?
They differ only for negative numbers. For positive inputs, they are identical. Remainder follows the sign of the dividend; modulo always matches the sign of the divisor. This calculator shows the true mathematical modulo.
The modulo operation explained
How to use the modulo
This modulo gives you instant, accurate results — no registration or download required. Enter your values above and get your result in seconds. The tool is free, works on all devices, and keeps your data private — nothing is stored or shared.
How the modulo works
The modulo calculator uses standard formulas used in mathematics, science, and engineering. Enter your inputs, and the tool calculates the result instantly in your browser. No server-side processing means your data stays on your device. Results update in real time as you change inputs.
Modulo in everyday life
Clocks (12-hour), days of the week (7), months (12), and military time (24-hour) all use modular arithmetic. To find what day of the week a date falls on, compute the day number mod 7. Calendar algorithms rely heavily on modular arithmetic.
Modulo in cryptography
RSA encryption uses modular exponentiation: message^e mod n. The security relies on the difficulty of computing discrete logarithms modulo large primes. Diffie-Hellman key exchange, used in every HTTPS connection, is also built on modular arithmetic.
Modulo and hashing
Hash tables use index = hash(key) % table_size to map arbitrary keys to array indices. A good hash function distributes keys uniformly, minimizing collisions. The modulo operation ensures the index stays within the array bounds regardless of key value.
Modulo: how it works
Built on well-established mathematical principles, this tool delivers accurate results for students, researchers, and professionals. Enter your values and get instant clarity without specialist software or manual arithmetic.
Who uses this tool?
Teachers, students, engineers, and data analysts use it to verify calculations, check homework, and solve problems faster. It is intuitive enough for beginners while comprehensive enough for professional use.
Learn more from an authoritative source:
WikipediaScientific Calculator
Evaluate mathematical expressions including trigonometry, logarithms, exponents, and more.
Percentage Calculator
Quickly calculate percentages, percentage change, and percentage of a total.
Fraction Calculator
Add, subtract, multiply, or divide two fractions and get the simplified result instantly.
Ratio Calculator
Simplify ratios, find missing values, and scale ratios up or down.
Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →