# Modulo Calculator

URL: https://hifreetools.com/calculators/modulo-calculator

> Find a mod b — the remainder when a is divided by b — along with the integer quotient and the non-negative (Euclidean) modulo for negatives.

## Quick answer

The modulo operation a mod b gives the remainder after dividing a by b. For 17 mod 5, 17 = 5 × 3 + 2, so the remainder is 2 and the quotient is 3. This calculator shows the remainder, the quotient, and a non-negative Euclidean result for negative dividends.

The tool computes the truncated quotient trunc(a ÷ b), which rounds toward zero (so −17 ÷ 5 gives −3, not −4), and the remainder a − quotient × b, which is exactly JavaScript's % operator and takes the sign of a. It also reports the Euclidean modulo ((a % b) + |b|) % |b|, always in the range 0 to |b| − 1, and verifies b × quotient + remainder = a.

## Examples

- Basic remainder: 17 mod 5 → 2
- Larger numbers: 100 mod 7 → 2
- Negative dividend: −17 mod 5 → −2 (Euclidean 3)

## FAQ

**What does a mod b mean?**
It is the remainder when a is divided by b. For 17 mod 5 the remainder is 2, because 17 = 5 × 3 + 2.

**What is the quotient?**
The whole number of times the divisor fits into the dividend, truncated toward zero. For 17 ÷ 5 the quotient is 3.

**Why is the remainder negative sometimes?**
When the dividend is negative, the standard (truncated) remainder takes the sign of the dividend. The tool also shows a non-negative Euclidean value.

**What is the Euclidean modulo?**
A version of modulo that is always in the range 0 to |b| − 1, computed as ((a % b) + |b|) % |b|. It is handy for wrapping indices and clock arithmetic.

**Can the divisor be zero?**
No. Dividing by zero is undefined, so the divisor must be non-zero.

**Does it work with decimals?**
No. This tool accepts whole numbers (integers) only, so the quotient and remainder are whole numbers too.


## Sources

- [Wikipedia — Modulo](https://en.wikipedia.org/wiki/Modulo)
- [Wikipedia — Euclidean division](https://en.wikipedia.org/wiki/Euclidean_division)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Modulo Calculator", https://hifreetools.com/calculators/modulo-calculator
