Basic Statistics

Modulo Calculator

Use this calculator to find the modulo when one integer is divided by another. Enter the dividend and divisor, then click Calculate to get a mod b with a clear, step-by-step solution.

Enter the integer you want to divide.
Enter the positive integer you want to divide by.

How to Use the Modulo Calculator

This calculator helps you find the modulo when one integer is divided by another. To use the calculator:

  1. Enter the number being divided as the dividend, a.
  2. Enter the number you are dividing by as the divisor, b.
  3. Click Calculate.

The calculator will instantly return the result of a mod b and show you how to find the modulo manually. For example, suppose you want to calculate 38 mod 7. You’ll need to enter 38 as the dividend, and 7 as the divisor, and the calculator will instantly return the modulo as: 38 mod 7 = 3.

Tip. The step-by-step solution also provides a quick verification of the result.

What Is Modulo?

Modulo tells you the remainder left after dividing one integer by another. It is commonly written as: a mod b = r

where:

  • a is the dividend
  • b is the divisor
  • r is the remainder

For example: 23 mod 5 = 3. This is because 23 divided by 5 gives a quotient of 4 with 3 left over. In other words, 23 ÷ 5 = 4 remainder 3. Therefore, the modulo is 3.

You may also see the modulo operation written with the percent symbol, such as 23 % 5, especially in computer programming. In mathematics, mod is usually clearer when expressing the operation.

How to Calculate Modulo

To calculate modulo by hand, divide the dividend by the divisor and find the remainder. The remainder is the modulo.

For a nonnegative dividend and a positive divisor, follow these steps:

  1. Divide the dividend (a) by the divisor (b).
  2. Drop any decimal or fractional part from the result to get the whole-number quotient (q).
  3. Multiply the whole-number quotient (q) by the divisor (b).
  4. Subtract the result from the original dividend (a) to get the remainder (r). The remainder is the modulo.

However, for a negative dividend, first take the absolute value of the dividend and calculate its remainder using the same steps. If the remainder is 0, the modulo is also 0. Otherwise, subtract the remainder from the divisor.

In other words:

  1. Take the absolute value of the negative dividend.
  2. Divide the absolute dividend (a) by the divisor (b).
  3. Drop the decimal part to get the quotient.
  4. Multiply the whole-number quotient (q) by the divisor (b).
  5. Subtract the result from the original dividend (a) to get the remainder (r).
  6. Subtract the remainder (r) from the divisor (b) to get the modulo of the original negative dividend.

Example 1: Find 38 mod 7

From the question, we know that:

  • Dividend, a = 38
  • Divisor, b = 7

To find the modulo manually, follow these steps:

  1. Divide the dividend by the divisor. 38 ÷ 7 = 5.428571…
  2. Drop the decimal part to get the whole-number quotient. Thus, q = 5
  3. Multiply the quotient by the divisor. 5 × 7 = 35
  4. Subtract the result from the dividend to get the remainder. 38 − 35 = 3

Therefore, the remainder is: r = 3. Since the remainder is 3, 38 mod 7 = 3

We can verify the answer using: a = bq + r

where:

  • a is the dividend
  • b is the divisor
  • q is the quotient
  • r is the remainder

Substituting the values, we get:

38 = 7(5) + 3

= 38

Therefore, 38 mod 7 = 3.

Example 2: Find −23 mod 6

From the question, we know that:

  • Dividend, a = −23
  • Divisor, b = 6

Since the dividend is negative, we can find the modulo by hand as follows:

  1. Take the absolute value of the dividend. |−23| = 23
  2. Divide the absolute value of the dividend by the divisor. Thus, 23 ÷ 6 = 3.8333…
  3. Drop the decimal part to get the quotient. Hence, q = 3
  4. Multiply the quotient by the divisor. In this case, we have: 3 × 6 = 18
  5. Find the remainder. Remainder = 23-18 = 5
  6. Subtract the remainder from the divisor to get the modulo. Since b = 6 and remainder = 5, the required modulo = 6-5 =1.

Therefore, −23 mod 6 = 1

We can verify the answer using: a = bq + r

For the original negative dividend:

  • a = −23
  • b = 6
  • q = −4
  • r = 1

Substituting the values, we get:

−23 = 6(−4) + 1

= −23

Therefore, −23 mod 6 = 1.

Tip. If the absolute value divides evenly by the divisor, no adjustment is needed. For example, 24 mod 6 = 0, so −24 mod 6 = 0 as well.

What Happens When the Dividend Is Smaller Than the Divisor?

If the dividend is a positive integer smaller than the divisor, the divisor cannot fit into it even once. The quotient is therefore 0, and the entire dividend becomes the remainder.

For example, find 9 mod 14

Since 14 goes into 9 zero whole times:

9 ÷ 14 = 0 remainder 9

Therefore, 9 mod 14 = 9

For positive integers, this gives us a useful rule: If 0 ≤ a < b, then a mod b = a.

What Does a Modulo of 0 Mean?

A modulo result of 0 means the divisor divides the dividend exactly, with nothing left over.

For example: 48 mod 8 = 0 because 48 ÷ 8 = 6 remainder 0

A zero remainder therefore tells us that 48 is divisible by 8.

This idea is useful when checking whether one integer is a factor of another. For example, a number is even whenever dividing it by 2 produces a remainder of 0.

Common Modulo Patterns

The table below shows a few simple patterns that can help you recognize modulo answers quickly.

SituationResult
a is exactly divisible by ba mod b = 0
a is positive and smaller than ba mod b = a
a = ba mod b = 0
b = 1a mod 1 = 0
a is evena mod 2 = 0
a is odda mod 2 = 1

For example:

  • 72 mod 9 = 0
  • 6 mod 11 = 6
  • 15 mod 15 = 0
  • 37 mod 2 = 1

These patterns are useful for checking an answer before performing the full calculation.

Where Is Modulo Used?

Modulo is useful whenever a calculation involves remainders or repeating cycles.

One common example is checking whether a number is even or odd. An integer is even when n mod 2 = 0 and odd when n mod 2 = 1.

Modulo also works well with repeating patterns. Clock arithmetic is a familiar example because hours repeat after a fixed number of positions. Similar ideas appear in computer programming, number theory, cyclic sequences, and divisibility problems.

If you need to use mod as part of a larger mathematical expression, you can also use our Statistics Calculator.

Frequently Asked Questions

What does mod mean in math?

Mod means modulo. It finds the remainder after one integer is divided by another. For example, 17 mod 6 = 5 because dividing 17 by 6 leaves a remainder of 5.

What is a modulo calculator?

A modulo calculator finds the remainder when a dividend is divided by a divisor. Enter a and b, and the calculator evaluates a mod b and shows the quotient, remainder, and calculation steps.

How do I calculate a mod b?

Divide a by b using whole-number division and identify the remainder. For example, 26 ÷ 7 = 3 remainder 5, so 26 mod 7 = 5.

What does it mean if a mod b equals 0?

A result of 0 means a is exactly divisible by b. For example, 36 mod 6 = 0 because 36 ÷ 6 = 6 with no remainder.

Can the dividend be smaller than the divisor?

Yes. When both numbers are positive, and the dividend is smaller than the divisor, the dividend itself is the remainder. For example, 4 mod 9 = 4.

Can modulo be calculated with negative numbers?

Yes. With a positive divisor, this calculator uses the mathematical convention that gives a nonnegative remainder smaller than the divisor. For example, −17 mod 5 = 3 because −17 = 5(−4) + 3.

Cite

Choose APA, MLA, Chicago, or Harvard, then copy the citation.

Mburu, J.. (2026, September 7). Modulo Calculator. StatCalc.net. Retrieved September 11, 2026, from https://statcalc.net/modulo-calculator/

Joseph Mburu

About This Calculator

Prepared by Joseph Mburu · Updated on

Joseph is an applied statistician and data analyst with over 6 years of experience helping students, researchers, and professionals solve statistics and data analysis problems. He holds a degree in Applied Statistics and a Master’s degree in Data…

We aim to keep our calculators accurate, easy to use, and helpful for learning. Always check that your inputs match the assumptions of the method you are using.