AbraCalc

Modulo Calculator

Calculate the remainder (modulo) of dividing one number by another.

Embed this tool on your site
Cite this tool

APA

AbraCalc. (2026). Modulo Calculator [Online calculator]. Retrieved from https://abracalc.com/calculator/modulo-calculator/

BibTeX

@misc{abracalc-modulo-calculator, author = {AbraCalc}, title = {Modulo Calculator}, year = {2026}, howpublished = {\url{https://abracalc.com/calculator/modulo-calculator/}} }

Did this tool answer your question?

How to use this tool

  1. Enter dividend (a) and divisor (b) in the fields above.
  2. Results update instantly as you type — or click Calculate.
  3. Read your remainder (a mod b) and the full breakdown beneath it.

The modulo operation (a mod b) returns the remainder after dividing a by b.

Formula

Remainder = a mod b

remainder = a % b

Equivalently: remainder = a − b × floor(a ÷ b)

How it works

This calculator returns the remainder after dividing the dividend (a) by the divisor (b), using the modulo operation. The result is the amount left over once as many whole multiples of b as possible have been subtracted from a. The calculator uses JavaScript’s % operator, which follows truncated division, so results for negative numbers match most programming languages rather than the mathematical modulo convention.

Worked example

  1. Enter a = 17 (dividend) and b = 5 (divisor).
  2. 17 ÷ 5 = 3 remainder 2, because 5 × 3 = 15 and 17 − 15 = 2.
  3. Remainder = 17 mod 5 = 2.

Remainder = 2.

Common mistakes to avoid

  • Confusing modulo with integer division; a mod b gives the remainder, not the quotient.
  • Expecting modulo to always return a positive value; in many languages -7 % 3 = -1, not 2.
  • Using modulo when the divisor is zero; division by zero is undefined and returns an error or NaN.

Key terms

Modulo
The operation that returns the remainder after integer division of one number by another.
Dividend (a)
The number being divided.
Divisor (b)
The number by which the dividend is divided.
Remainder
What is left over after dividing as many whole copies of the divisor from the dividend as possible.
Truncated division
Division where the quotient is rounded toward zero, which determines the sign of the remainder in most programming languages.

Frequently asked questions

What is the modulo operation?
The modulo (%) returns the remainder of a division. For example, 17 mod 5 = 2 because 17 = 3×5 + 2.

References & sources