Mini Calculator Logo. Calculate Modulo

Modulo Calculator.

Enter two numbers, with the first number a being the dividend while the second smaller number n is the divisor. This tool will then conduct a modulo operation to tell you how many times the second number is divisible into the first number & find the remainder after division is complete.

Calculations happen automatically when you click out of any form fields.

Enter Your Mod Calculation
Your Results
remainder =
full calculation


You may see modulo operations on numbers expressed as either of the following

  • a modulo n
  • a mod n (abbreviated version)

Example Math Problems

17 modulo 3

  • 17 - 3 = 14
  • 14 - 3 = 11
  • 11 - 3 = 8
  • 8 - 3 = 5
  • 5 - 3 = 2

20 mod 5

  • 20 - 5 = 15
  • 15 - 5 = 10
  • 10 - 5 = 5
  • 5 - 5 = 0

Modulo: Definition, How it Works, and Real-Life Uses

- Guide Authored by Corin B. Arenas, published on October 24, 2019

Most people haven’t heard of modular arithmetic or mod outside of math class.

However, if you’ve ever estimated lunch for 10 people, and found that there’s a lot of food leftover, you’re actually dealing with a mod problem. People use modular arithmetic all the time, especially with anything involving remainders, time and calendar schedules.

In this section, you’ll learn about modulo, its basic operation, and its uses in real life.

What is Modulo?

Slice of cake

Modular arithmetic, sometimes called clock arithmetic, is a calculation that involves a number that resets itself to zero each time a whole number greater than 1, which is the mod, is reached. An example of this is the 24-hour digital clock, which resets itself to 0 at midnight.

In mathematics, the modulo is the remainder or the number that’s left after a number is divided by another value. Modulo is also referred to as ‘mod.’

The standard format for mod is:
a mod n
Where a is the value that is divided by n.

For example, you’re calculating 15 mod 4. When you divide 15 by 4, there’s a remainder.
15 / 4 = 3.75

Instead of its decimal form (0.75), when you use the mod function in a calculator, the remainder is a whole number. For this example, 15 / 4 = remainder 3, which is also 15 = (4 * 3) + 3. Here’s how to calculate it manually:

15 mod 4
15 – 4 = 11
11 – 4 = 7
7 – 4 = 3

Calculating Mod with a Negative Number

Professor teaching

One might presume the mod function generates the same values as positive numbers when one number is negative. This is actually not the case.

For instance, if you have 340 mod 60, the remainder is 40.
But if you have -340 mod 60, the remainder is 20.

Why does this happen? explains, with a positive number like 340, the multiple subtracted is less than the absolute value, which results in 40.

340 mod 60
340 – 60 = 280
280 – 60 = 220
220 – 60 = 160
160 – 60 = 100
100 – 60 = 40

But with -340, we subtract a number with a greater absolute value, so the mod function generates a positive value. The resulting remainder is also smaller compared to when both numbers are positive.

Here’s how to solve mod with a negative number:
a mod n is a/n = r (remainder)
Therefore, a mod n = a – r * n

Take note: When we input a/b in a calculator, we take the decimal part of the generated value, and round it up to the next integer. Let’s do it with the example below:

-340 mod 60
-340/60 = 5.6, when we take the decimal part, it becomes the integer -6
= -340 -(-6) * 60
= -340 -(-360)
= 20

To help you visualize, the number line below shows the difference in value.

Difference in value

Who Created Modular Arithmetic?

Chinese scroll

According to Britannica, the concept of modular arithmetic has been used by ancient civilizations such as the Indians and Chinese. An example is the Chinese book Master Sun’s Mathematical Manual, which dates back from 300 AD.

Moreover, modular arithmetic was used to solve astronomical and seasonal calculations which were problems associated with natural and man-made cycles.

Carl Friedrich Gauss and the Number Theory

Carl Gauss

In Western mathematics, German mathematician and physicist Carl Friedrich Gauss did the first systematic study of modular arithmetic. Gauss is regarded as one of the most influential figures in modern mathematics.

In his early 20s in 1801, he published Disquisitiones Arithmeticae, which laid the foundation for today’s number theory and showed the first proof of the law of quadratic reciprocity.

In the number theory, scholars analyze the properties of natural numbers, which are whole numbers like -1, -2, 0, 1, 2, and so on. Their objective is to discover unexpected mathematical patterns and interactions between natural numbers. 

Britannica notes that in modular arithmetic, where mod is N, all the numbers (0, 1, 2, …, N − 1,) are known as residues modulo N. The residues are added by finding the arithmetic sum of the numbers, and the mod is subtracted from the sum as many times as possible. This diminishes the sum to a number M, which is between 0 and N – 1.

In his book, Gauss included a notation with the symbol ≡, which is read as “is congruent to.” Instead of the usual = symbol, the three horizontal line segments both signify equality and definition.

For instance, if we add the sum of 2, 4, 3 and 7, the sum is congruent to 6 (mod 10). That’s 16 ≡ (mod 10). This means 16 divided by 10 leaves a remainder of 6. Likewise, 16 – 10 = 6.

Another example, 13 ≡ 1 (mod 12). This means 13 divided by 12 leaves a remainder of 1. Likewise, 13 – 12 = 1.

What are Real-World Uses for Mod?

Divided Assets.

For practical applications, mod is especially useful for dealing with time.

Since we have 24 hours in a day, it makes sense to refer to time in a 24-hour fashion. This is the principle behind the military time system, beginning at midnight with 0000 hours, and ending the hour at 11PM with 2300 hours.

9 O'Clock

Instead of saying 9 o’clock PM, they say 2100 hours. The military uses this to coordinate with bases and other personnel located in different time zones. Moreover, all pilots (commercial or otherwise) use the 24-hour clock to avoid confusion while traveling between time zones.  

To set a standard, pilots and the military use the Greenwich Mean Time (GMT) which they also call Zulu time (Z). For instance, when pilots report that a plane will reach a base at 2100Z, it means it will arrive at 9PM GMT.

How is this connected with modulo? For people staying in one time zone, it’s more important to tell time by separating night and day. This is why the 12-hour standard time uses modulo.

Instead of saying 1600 hours, we just say 4 o’clock. The 12-hour standard time uses mod 12 so that 1600 hours becomes 4 o’clock.

When we make appointments, it’s generally understood people mean 4 in the afternoon. Unless specified otherwise, a 4am meeting is absurd, unless you work at night and have online meetings with clients from other time zones.

Organizing Books, Bank Info, and Housing Loan Rates

Credit cards

Mod is useful for organizing large information. Books are tracked using modular arithmetic to calculate checksums for international standard book numbers (ISBN). In 2007, a 13-digit ISBN number system (which was previously 10) was introduced to help manufacturers identify a large volume of books.

The same principle is also used by banks to identify errors on international bank account numbers (IBAN) when they track transactions from other countries.

When it comes to housing loans, mod is used to reset calculations for a new period. For instance, a 5/6 adjustable rate mortgage (ARM) resets its interest rates periodically every 6 months. Mod is used to adjust the rates accordingly.

Cryptography and Computer-Generated Art

Modular art

Modular arithmetic has other applications in the field of cryptography, art and graphics design.

For many years, artists have been using mathematical shapes based on formulas to create designs. Today, the same concept is applied to computer graphics, as well as sculptures and modern paintings.

In cryptography, codes are written to protect secret data. Cryptographers use mod in the Diffie-Hellman Key Exchange in setting up SSL connections to encrypt web traffic.

Encryption is important because it allows users to safeguard information. That’s why your personal emails, credit card number, and other personal details should be encrypted whenever you send information on the internet.

The Bottom Line

Mod is a mathematical function that allows us to measure the remainder in a sum. We use this fundamental concept whenever we tell time. 

The concept of modular arithmetic has been used by ancient Chinese and Indians for centuries. But it was introduced into Western mathematics by German scientist Carl Friedrich Gauss, who also developed the basis for the number theory.

Real-world uses for mod include organizing ISBN and bank information, resetting ARM rates, computer graphics design, and cryptography which helps protect private data.

About the Author

Corin is an ardent researcher and writer of financial topics—studying economic trends, how they affect populations, as well as how to help consumers make wiser financial decisions. Her other feature articles can be read on and She holds a Master’s degree in Creative Writing from the University of the Philippines, one of the top academic institutions in the world, and a Bachelor’s in Communication Arts from Miriam College.