Example 1
- a = 17
- b = 5
2
What is 17 mod 5? 2. 15 fits in 17, 2 is left.
Type dividend a and divisor b, both non-negative. 17 and 5 give 2. 10 and 3 give 1. 8 and 4 give 0. 17.9 first drops to 17.
The fields have min=0, so the calculator is for non-negative values. The engine takes the remainder of the integer parts of a and b. When b = 0 the result is a blank value and the box stays blank.
Enter data and click Calculate.
Modulo (remainder) asks how much is left after dividing a by b. 17 = 3 · 5 + 2, so 17 mod 5 is 2. The calculator first takes the integer part of both fields, then the % operator.
10 and 3 give 1, because 9 fits in 10 and 1 is left. 8 and 4 give 0: the division comes out clean. 17.9 and 5 also give 2, because 17.9 drops to 17 before it enters %.
Fields a and b have min=0. The browser keeps the input on non-negative numbers. This calculator does not compute a negative modulo. A comma in 17.9 still goes through floor.
When b = 0 the formula returns a blank value. The display clears the box on a blank value, so you see a blank, not the word a blank value and not zero. That is not a remainder of 0.
Floor is on the neighbouring page, because the same integer-part step cuts the fraction from a and from b. Signum does not divide. Here you always stay with a remainder of two non-negative floors.
17 and 5 give 2. 10 and 3 give 1. 8 and 4 give 0.
(b !== 0) ? (Math.floor(a) % Math.floor(b)) : a blank value
a mod b after the integer part on both fields. 17 and 5 give 2. 10 and 3 give 1. 8 and 4 give 0. b = 0 leaves a blank.
2
What is 17 mod 5? 2. 15 fits in 17, 2 is left.
1
What is 10 mod 3? 1. 9 fits in 10, 1 is left.
0
What is 8 mod 4? 0. The division comes out clean.
2. 17 = 3 · 5 + 2. The result is 2.
The remainder when a is divided by b. Here after the integer part on both fields. 10 and 3 give 1.
1 and 0. Zero means b divides a after floor.
2. Floor of 17.9 is 17, then 17 % 5 = 2.
The formula returns a blank value. The calculator clears the result, so you see a blank, not zero.
The fields have min=0. This calculator is for non-negative values. You do not compute a negative % here.
Division returns the quotient. Here the remainder stays. 17 / 5 is 3.4. 17 mod 5 is 2.
Yes, and it still goes through floor. The result with 5 is 2.
On the floor page. Here floor is only the preparation for %.
Yes. 4 = 0 · 8 + 4, so the remainder is 4. The order of a and b matters.
The calculator computes the same formula as the definition below.
Page updated in 2026.