Modulo Calculator
Integer remainder with a = q·m + r and 0 ≤ r < |m|. Euclidean convention, not JavaScript truncated %.
Trust summary Engine tested · Specification checked · 9/9 tests · Production surface contract 4/4 · v1.0.0
- Input interpretation
- Enter values to calculate.
- Result
- —
- Model
- Euclidean quotient and remainder for integers a and m ≠ 0.
- Scope
- Euclidean remainder
- Verification
- Engine tested · 9/9 tests · Production surface contract 4/4 · Specification checked · v1.0.0
- Named expert review
- Optional · Not performed
- Specification basis
- ISO 80000-2:2019 Quantities and units — Mathematics (integer division / remainder)
- Knuth, The Art of Computer Programming, Euclidean division (remainder ≥ 0)
- Evidence
- 2 golden · 2 boundary · 5 property · Production surface contract 4/4 · Artifact integrity PASS
- Production
- Embedded snapshot: unpublished · Build schema 1.0.0 ready · Semantic contract ✓ · Attestation report not published on origin · Live production status PASS (0 stale; 164 CURRENT) @ 2026-09-16T06:44:24.909Z
- Semantic contract
- PASS
Formulas
Core equations used by this calculator.
How to use
Enter dividend a
Any integer, including negative values.
Enter a non-zero modulus
The remainder is always in [0, |m|), even when m is negative.
Read remainder and quotient
Check a = q·m + r.
Example calculations
Common configurations with formula and result.
Positive remainder
17 divided by 5
Negative dividend
JavaScript (−17)%5 is −2; Euclidean remainder is 3
Negative modulus
Remainder still in [0, |m|)
Modulo calculator specification
Version 1.0.0 · Engine tested
- Engine tested 9/9 tests · Production surface contract 4/4
- Named expert review Not performed
- Calculation version 1.0.0
- Definition
- Euclidean division writes a = q·m + r with remainder r satisfying 0 ≤ r < |m|. This is not JavaScript’s truncated remainder operator.
- What it calculates
- Euclidean quotient and remainder for integers a and m ≠ 0.
- Inputs
- a
- modulus
- Outputs
- remainder
- quotient
- identity
- Formula
a = q·m + r, 0 ≤ r < |m|- Assumptions
- Euclidean remainder
- Not JavaScript truncated %
- Integers only
- Units
- dimensionless
- Boundary conditions
- missing a or modulus → MISSING_REQUIRED_INPUT
- modulus = 0 → DIVISION_BY_ZERO
- Example
- a=-17 modulus=5 → remainder=3
- Validation cases
3 published on this page · 9/9 tests · Production surface contract 4/4 · View evidence
- a=17 modulus=5 → remainder=2
- a=-17 modulus=5 → remainder=3
- a=10 modulus=0 → error DIVISION_BY_ZERO
- Specification basis
- ISO 80000-2:2019 Quantities and units — Mathematics (integer division / remainder)
- Knuth, The Art of Computer Programming, Euclidean division (remainder ≥ 0)
- Calculation version
- 1.0.0
Related tools
Other calculators in this family: Factorial Calculator, GCF Calculator, LCM Calculator, Permutation Combination Calculator, Prime Factorization Calculator . Explore all Number Theory & Discrete Math.
Frequently asked questions
Key distinctions behind the calculation.
Why is (−17) mod 5 equal to 3, not −2?
This page uses the Euclidean remainder. Remainders are never negative. JavaScript % truncates toward zero, so (−17)%5 is −2.
Is this floating-point remainder?
No. Integers only. Not IEEE remainder and not fmod.
Where does this run?
Locally in the browser by default. REST and MCP call the same modulo engine.