Category

Modulo Calculator — Find x mod y with Step-by-Step Solution

Calculate the modulo (remainder) of any division instantly. Enter dividend x and divisor y to find x mod y = r. Supports basic modulo, modular arithmetic (add, subtract, multiply, exponentiate), US/Imperial & metric units, and 12 world currencies.

0 calculations

Calculator Settings

Enter your numbers

Enter the dividend and divisor on the left, then click Calculate Modulo to see the step-by-step result.

What Are Modulo Operations?

Imagine a clock hanging on a wall. It's 11 pm and you wonder what time it will be after 8 hours of sleep. You can't just add 8 to 11 — there's no 19 am. You perform a modulo operation (mod 12): add the two numbers and keep subtracting 12 until you get a result less than 12. The answer is 7, meaning you wake up at 7 am. Modulo operations work exactly this way — numbers "wrap around" a fixed value.

In mathematics, x mod y = r if there exists an integer q (the quotient) such that:

x = q × y + r

Here, r is the remainder, x is the dividend, and y is the divisor.

What Is Modulo Congruence?

Two integers a and b are said to be congruent modulo n if their difference a − b is divisible by n. We write this as:

a ≡ b (mod n)

For example, 24 and 34 are congruent modulo 10 because 34 − 24 = 10, which is a multiple of 10. Equivalently, both give the same remainder when divided by 10: 24 mod 10 = 4 and 34 mod 10 = 4.

Another example: 9 ≡ 21 (mod 6) because 21 − 9 = 12 = 2 × 6. Check: 9 mod 6 = 3 and 21 mod 6 = 3 ✔

How to Calculate the Modulo — an Example

Let's find 250 mod 24 step by step:

  1. Divide 250 ÷ 24 = 10.4167…
  2. Floor (round down): ⌊10.4167⌋ = 10 (this is the quotient q)
  3. Multiply: 10 × 24 = 240
  4. Subtract: 250 − 240 = 10

Therefore 250 mod 24 = 10. Verify: 250 = 10 × 24 + 10 ✔

How to Use Our Mod Calculator — 10 mod 3 and More Examples

Using our calculator is simple:

  1. Enter the dividend (x) — the number to be divided.
  2. Enter the divisor (y) — the number to divide by (must not be zero).
  3. Optionally choose a display unit (US/Imperial, metric, or world currency).
  4. Click Calculate Modulo to instantly see the quotient, remainder, and step-by-step solution.

Common modulo examples:

  • 1 mod 1 = 0 (mod 1 is always 0)
  • 1 mod 2 = 1
  • 5 mod 2 = 1
  • 5 mod 3 = 2
  • 6 mod 3 = 0
  • 7 mod 3 = 1
  • 10 mod 3 = 1
  • 18 mod 3 = 0
  • 100 mod 7 = 2

Modular Arithmetic

Modular arithmetic performs addition, subtraction, multiplication, and exponentiation where numbers "wrap around" a fixed modulus. All of these statements are equivalent:

  • A ≡ B (mod C)
  • A mod C = B mod C
  • C divides (A − B)
  • A = B + K × C for some integer K

1. Modular Addition and Subtraction

(A + B) mod C = (A mod C + B mod C) mod C
(A − B) mod C = (A mod C − B mod C + C) mod C

Example (A=11, B=7, C=4): (11+7) mod 4 = 18 mod 4 = 2. Check: (11 mod 4 + 7 mod 4) mod 4 = (3+3) mod 4 = 6 mod 4 = 2

2. Modular Multiplication

(A × B) mod C = (A mod C × B mod C) mod C

Example (A=11, B=7, C=4): (11×7) mod 4 = 77 mod 4 = 1. Check: (3×3) mod 4 = 9 mod 4 = 1

3. Modular Exponentiation

A^B mod C = ((A mod C)^B) mod C

Example (A=11, B=7, C=4): 11^7 mod 4 = 19,487,171 mod 4 = 3. Check: (11 mod 4)^7 mod 4 = 3^7 mod 4 = 2187 mod 4 = 3

Our calculator uses fast modular exponentiation (binary exponentiation), which handles very large exponents efficiently without integer overflow.

Modulo Definition Ambiguity

The sign of the remainder depends on the programming language or convention used. Our calculator follows the floored division convention (as used in Python and most mathematics textbooks): the remainder always has the same sign as the divisor. This ensures r ≥ 0 when the divisor is positive.

For example: −7 mod 3 = 2 (floored), because −7 = (−3) × 3 + 2.

The Percent Symbol — Modulo Notation

In many programming languages (C, Java, JavaScript, PHP), the % symbol represents the modulo operation. So 10 % 3 and 10 mod 3 both equal 1. In mathematics, mod is the standard notation.

Modulo Applications

  • Clock arithmetic — determining the time after N hours (mod 12 or mod 24).
  • Cryptography — RSA encryption, Diffie-Hellman key exchange, and other public-key systems rely on modular exponentiation.
  • Checksums and hashing — ISBN, credit card (Luhn algorithm), and cyclic redundancy checks (CRC) use modular arithmetic.
  • Calendar calculations — finding the day of the week for any date (Zeller's congruence).
  • Distributing items evenly — splitting items into groups and finding how many are left over.
  • Computer science — wrap-around in arrays, circular buffers, and game maps.
  • Finance — distributing amounts evenly across accounts or periods, finding change remainders in currency.

FAQs

What is x mod 1?
Always 0, for any integer x, because every integer is divisible by 1 with no remainder.
What is 0 mod y?
Always 0, because 0 divided by any non-zero number leaves no remainder.
Can the divisor be negative?
Mathematically yes — the remainder takes the sign of the divisor under floored division. Our calculator requires integer inputs and handles negative values correctly.
What is the difference between modulo and remainder?
They differ only for negative numbers. With floored division (modulo), the result always has the same sign as the divisor. With truncated division (remainder/C-style %), it has the same sign as the dividend.
How does modulo apply to currencies?
If you have $250 and want to distribute it in groups of $24, modulo tells you $10 is left over after forming 10 complete groups of $24.

Calculation History

Loading...