Skip to content

Modulo Calculator

Calculate the remainder of division (modulo operation) for any two numbers.

Loading...
1. Enter the dividend (the number being divided) in the first field. 2. Enter the divisor (the number to divide by) in the second field. 3. View the remainder (modulo result) and quotient instantly. 4. See the complete division equation showing dividend = divisor x quotient + remainder. 5. Review how negative numbers are handled in the modulo operation. 6. Click the copy button to copy the result.

About This Tool

The Modulo Calculator computes the remainder when one integer is divided by another. Enter a dividend and a divisor, and the tool instantly shows the quotient, the remainder (modulo result), and the complete division equation. It handles positive numbers, negative numbers, and explains how different programming languages treat negative modulo differently.

The modulo operation (often written as a mod b or a % b) is fundamental in mathematics and computer programming. It is used everywhere - from determining if a number is even or odd (n mod 2) to implementing circular buffers, hash functions, clock arithmetic, and cryptographic algorithms. Understanding modular arithmetic is essential for any programmer or math student.

This calculator also explains the relationship between division, quotient, and remainder using the division algorithm formula. It supports large numbers and provides clear visual feedback showing exactly how the modulo result is derived from the division. Whether you are debugging code, solving number theory problems, or just need a quick remainder check, this tool delivers.

Formula / How It Works

a mod b = a - b x floor(a / b) | Division algorithm: a = b x q + r where 0 <= r < |b|

Frequently Asked Questions

The modulo operation finds the remainder after dividing one number by another. For example, 17 mod 5 = 2 because 17 divided by 5 is 3 with a remainder of 2 (5 x 3 + 2 = 17).
For positive numbers, modulo and remainder are the same. For negative numbers, they can differ depending on the convention. In mathematics, the modulo result is always non-negative. In some programming languages (like C and Java), the % operator returns the remainder, which can be negative.
Modulo is used to check if a number is even or odd (n % 2), to wrap around array indices (index % length), to implement circular behavior (clock arithmetic), and in hash table implementations. It is one of the most commonly used arithmetic operators in code.
Modular arithmetic is a system of arithmetic for integers where numbers "wrap around" after reaching a certain value (the modulus). Clock arithmetic is a real-world example: 10 o'clock + 5 hours = 3 o'clock because 15 mod 12 = 3.
Division by zero is undefined, so modulo with a divisor of zero is also undefined. The calculator will show an error if you enter 0 as the divisor.

Related Tools

GCD and LCM Calculator

Find the greatest common divisor and least common multiple of two or more numbers.

Math and Numbers

Prime Number Checker and Generator

Check if a number is prime and generate lists of prime numbers in any range.

Math and Numbers

Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal, and any custom base.

Math and Numbers

Exponent and Power Calculator

Calculate powers, exponents, and exponential expressions with support for any base and exponent.

Math and Numbers