Utinzo

Modulo Calculator

Calculate the remainder of division (modulo operation). Supports positive and negative numbers and shows the full division breakdown.

17 mod 5
2
Quotient (floor division)3
Verification5 × 3 + 2 = 17
JS % operator result2

Did this tool work for you?

AdSense336 × 280
AdSense336 × 280

How to use this calculator

a mod m = a − m × floor(a/m)

The modulo operation returns the remainder when a is divided by m.

  1. 1

    Enter the dividend (number being divided).

  2. 2

    Enter the modulus (divisor).

  3. 3

    The result is the remainder after floor division.

  4. 4

    Note: for negative numbers, mathematical modulo differs from the % operator in most languages.

AdSense · 728 × 90

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.

About modulo calculator

The modulo operation explained

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 Calculator – Utinzo

Learn more from an authoritative source:

Wikipedia
Related tools

Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →