Modulo Calculator

Modulo gives the remainder after division and is used in clock arithmetic, calendars, programming and checksums.

Results update as you type.

−17 mod 5

3

mathematical modulo (never negative)

Remainder (truncated, as in C, Java, JavaScript %)
−2
Quotient (rounded down)
−4

For positive numbers both answers are the same; they differ when the dividend is negative.

About this calculator

For negative numbers, maths and most programming languages give different answers; the calculator shows both.

How to use it

  1. Enter the dividend.
  2. Enter the divisor.
  3. Read both results.

The formula

a = n × q + r, with 0 ≤ r < |n|
r
the mathematical modulo
%
truncated remainder in many languages

Worked example

−17 mod 5

  1. Mathematical modulo: 3, because −17 = 5 × (−4) + 3.
  2. JavaScript −17 % 5 = −2.

What the result means

In Python, % already gives the mathematical result.

Assumptions

  • Real numbers.

Limitations

  • The divisor cannot be zero.

Frequently asked questions

What is 17 mod 5?

2.

What is −1 mod 12?

11 in mathematics.

Is modulo the same as remainder?

For positive numbers yes; for negatives they can differ.

Last reviewed on 3 October 2026. Found a mistake? Tell us.