Modulo Calculator
Integer remainder with a = q·m + r and 0 ≤ r < |m|. Euclidean convention, not JavaScript truncated %.
Enter values to calculate.
Trust summary CVP VERIFIED · production STALE · CVP protocol 1.0.0-proposed · Core assurance · all published modes
- Input interpretation
- Enter values to calculate.
- Result
- —
- Verified scope
- all published modes
- Assurance
- Core
- Declared partition coverage
- PASS · 3/3 declared partitions (remainder, inverse, invalid-domain) · Matrix
- Known limitations
- Core CVP does not include live graph, viewport, or pointer interaction.
- Model
- Euclidean quotient and remainder, or modular inverse, for integers a and m ≠ 0.
- Scope
- Euclidean remainder
- Verification
- Engine tested · Specification checked · v1.1.1 · CVP VERIFIED · production STALE · CVP protocol 1.0.0-proposed · Core assurance · all published modes· View Manifest · CVP overview · Specification
- Versions
- Calculation 1.1.1 · CVP protocol 1.0.0-proposed · Evidence 2026-10-07.signed-bigint-publication
- Verification revision
- 2026-10-07.signed-bigint-publication · 2/2 property · digest b805f6620fef
- Legacy regression
- 13/13 tests · Production surface contract 6/6
- Trust layers
- Verification VERIFIED · Production STALE · Overall CVP state: VERIFIED_STALE under CVP 1.0.0-proposed
- CVP status
- STALE · Capability production binding: STALE · Site report: STALE · Evidence changed after the last successful production attestation. Re-attestation required.
- Reference
- O1 model · O2 expected_values · O2 numerical_behavior
- Interfaces
- PASS · UI (SSR) / REST / MCP
- Supplemental domain review
- Not performed
- Named expert review
- Not performed
- CVP suite
- 8/8 golden · 5/5 CVP boundary · 8/8 invalid · 2/2 property · 4/4 cross-interface · 1/1 cross-calculator · 6/6 CVP contract · Manifest
- Specification basis
- ISO 80000-2:2019 Quantities and units — Mathematics (integer division / remainder)
- Knuth, The Art of Computer Programming, Euclidean division (remainder ≥ 0)
- Evidence
- 3 legacy golden · 4 legacy boundary · legacy regression suite · 8/8 oracle-backed golden · 8/8 invalid · Artifact integrity PASS
- Semantic contract
- PASS
Full verification
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.1.1 · Engine tested
- Engine tested 13/13 tests · Production surface contract 6/6
- Named expert review Not performed
- Calculation version 1.1.1
- 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, or modular inverse, for integers a and m ≠ 0.
- Inputs
- mode?
- a
- modulus
- Outputs
- remainder
- quotient
- inverse
- 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 · 13/13 tests · Production surface contract 6/6 · 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.1.1
Related tools
Other calculators in this family: Arithmetic Sequence Calculator, Factorial Calculator, Fibonacci Calculator, GCF Calculator, Geometric Sequence Calculator, LCM Calculator, Modular Inverse Calculator, Permutation Combination 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 is the modular inverse?
Mode=inverse on this same engine, also at /calc/math/modular-inverse. GCF stays /calc/math/gcf.