Skip to main content
MathKit

Modulo Calculator

Compute A mod B — the remainder left after dividing A by B.

Calculator

Use the Modulo Calculator

Result

—

Formula

A mod B

Step-by-step

  1. 1

    Enter both numbers

    A is divided by B.

  2. 2

    Read the remainder

    The result is what is left over.

Worked example

Example input: a: 17, b: 5

Result: 2

Related tools

Frequently asked questions

What does A mod B mean?

A mod B is the remainder when A is divided by B. For example, 17 mod 5 is 2, because 5 fits into 17 three times (15) and 2 is left over.

How are negative numbers handled?

This calculator follows the JavaScript remainder operator, so the result takes the sign of the dividend: −7 mod 3 is −1. If you need the least non-negative remainder, add the divisor to a negative result (−1 + 3 = 2).

Can the divisor be zero?

No. Division by zero is undefined, so the calculator shows a validation message if B is 0.

What is modulo used for?

Modulo appears in clock arithmetic (hours wrapping at 12 or 24), divisibility tests, hashing, error-detection codes, and cryptography. It answers what remains after equal groups are removed.

What is 15625 mod 23?

8. The divisor fits 679 whole times (23 × 679 = 15617), and 15625 − 15617 = 8 is left over, so 15625 mod 23 = 8.

What is 169 mod 17?

16. Seventeen fits into 169 nine times (17 × 9 = 153), leaving 169 − 153 = 16 as the remainder. Since 16 < 17, that is the final answer.

What is 81 mod 7?

4. Seven goes into 81 eleven times (7 × 11 = 77), and the leftover 81 − 77 = 4 is the remainder.

What is 385 mod 192?

1. The divisor fits twice (192 × 2 = 384), leaving 385 − 384 = 1. When the remainder is 1, the two numbers share no common factor above 1.

What is 255 mod 256?

255. When the dividend is smaller than the divisor, nothing can be subtracted, so the remainder is the dividend itself: 255 mod 256 = 255, 4 mod 9 = 4, and so on.

When is A mod B equal to 0?

Exactly when B divides A with nothing left over, which means A is a multiple of B — for example, 20 mod 10 = 0 and 343 mod 7 = 0 (7 × 49 = 343). This zero check is the standard divisibility test.

Useful links