Modulo Calculator

Calculate the remainder of any division operation instantly.

Remainder after divisionMath + programmingUpdated May 2026

The number being divided.

The divisor cannot be zero.

Live remainder · Equation form · Updated May 2026

Modulo result

17 mod 5 = 2

Remainder after division.

Quotient

3

How many full times the divisor fits.

Dividend

17

Divisor

5

Mode

Euclidean modulo

For a positive modulus, the remainder is kept non-negative.

Equation form

17 = 5 × 3 + 2

Congruence form

17 ≡ 2 (mod 5)

17 mod 5 = 2 because the division leaves 2 as the remainder.
The quotient is 3 and the remainder is 2.
Modulo is useful for repeating cycles, such as clocks, schedules, and array indexing.
The divisor is the modulus that defines the repeating cycle.
Negative modulo can differ between mathematical and programming conventions.
A non-zero remainder means the division is not exact.

Modulo Formulas and Rules

Modulo / remainder

a mod b = r

Division relationship

a = bq + r

Euclidean quotient

q = floor(a ÷ b), when b is positive

Remainder range

0 ≤ r < b, when b is positive in Euclidean modulo

Congruence

a ≡ r (mod b)

Example

17 = 5 × 3 + 2, so 17 mod 5 = 2

Variable Explanations

a

Dividend, or number being divided.

b

Divisor, or modulus.

q

Quotient, or full division count.

r

Remainder, or modulo result.

mod

Modulo operation.

Congruence

Two numbers have the same remainder after division by the modulus.

Rule

The divisor cannot be zero.

What Modulo Means

Remainder after division

Modulo finds what is left after dividing.

Closely related to division

It uses quotient and remainder.

Repeating cycles

Modulo is useful when values wrap around.

Even or odd

10 mod 2 = 0, so 10 is even.

Divisibility

14 mod 7 = 0, so 14 is divisible by 7.

Programming use

Modulo appears in clocks, calendars, hashing, and array indexing.

Worked Examples

17 mod 5

Division statement: 17 = 5 × 3 + 2

Quotient: 3

Remainder: 2

5 fits into 17 three times with 2 left over.

20 mod 4

Division statement: 20 = 4 × 5 + 0

Quotient: 5

Remainder: 0

A zero remainder means 20 is divisible by 4.

23 mod 10

Division statement: 23 = 10 × 2 + 3

Quotient: 2

Remainder: 3

This is useful for extracting the last digit of a positive integer.

7 mod 3

Division statement: 7 = 3 × 2 + 1

Quotient: 2

Remainder: 1

The remainder after dividing by 3 is 1.

Even/odd with mod 2

Division statement: 11 = 2 × 5 + 1

Quotient: 5

Remainder: 1

A remainder of 1 means 11 is odd.

Clock example

Division statement: 14 mod 12

Quotient: 1

Remainder: 2

On a 12-hour cycle, 14 wraps to 2.

Array index example

Division statement: index mod arrayLength

Quotient: varies

Remainder: wrapped index

Modulo keeps indexes inside a repeating range.

Negative example

Division statement: -7 mod 3

Quotient: -3 or -2 depending on convention

Remainder: 2 in Euclidean mode

Negative modulo behavior depends on the chosen convention.

Modulo in Programming and Number Theory

Even/odd checks

n % 2 checks whether a number is even or odd.

Divisibility

n % divisor = 0 means exact divisibility.

Wrapping indexes

index % arrayLength keeps indexes inside an array.

Clock arithmetic

hour % 12 wraps time around a 12-hour clock.

Cyclic schedules

Modulo helps repeat schedules or rotations.

Number theory

Congruences compare remainders under the same modulus.

Negative Numbers and Modulo Behavior

Euclidean modulo

Euclidean modulo keeps the remainder non-negative when the divisor is positive. This is often preferred in math explanations.

Programming remainders

Some programming languages return a remainder with the same sign as the dividend. This calculator lets you compare Euclidean and JavaScript-style behavior.

Common Modulo Mistakes

Confusing the quotient with the remainder.
Trying to use zero as the divisor.
Assuming modulo gives the division result.
Forgetting that exact division gives remainder 0.
Confusing mod with percentage.
Misunderstanding negative modulo behavior.
Ignoring language-specific differences in programming.
Using modulo with decimals without checking the chosen calculator behavior.

Understanding Your Results

Modulo result

The remainder left after division.

Quotient

How many full times the divisor fits into the dividend.

Equation form

Shows dividend as divisor times quotient plus remainder.

Congruence form

Shows the equivalent remainder under the modulus.

Zero remainder

Means the dividend is divisible by the divisor.

Frequently Asked Questions