Calculator Directory
Mathematics

Modulo Calculator for Nonnegative Remainders

Find the nonnegative remainder after division by a positive integer. A negative dividend wraps around the modulus, so −17 modulo 5 gives 3.

Inputs

Remainder
3

Formula & assumptions

r = a − m × floor(a/m)

A negative dividend still gives a remainder between zero and m − 1.

Worked example

Dividend
-17
Modulus
5
Remainder
3

Interpreting the result

Adding or subtracting any whole multiple of the modulus leaves the displayed remainder unchanged.