Modulo Calculator
Find exact Euclidean quotients and remainders for signed integers up to 48 digits. Check identities, calculate modular inverses, and share complete results.
Enter values to calculate.
Trust summary CVP VERIFIED · CVP protocol 1.0.0-proposed · Core assurance · Sampled complete packs for both published modes, all signed branches and bounded48-digit cases
- Input interpretation
- Enter values to calculate.
- Result
- —
- Verified scope
- Sampled complete packs for both published modes, all signed branches and bounded48-digit cases
- 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 · Source checked · v1.1.2 · CVP VERIFIED · CVP protocol 1.0.0-proposed · Core assurance · Sampled complete packs for both published modes, all signed branches and bounded48-digit cases· View Manifest · CVP overview · Specification
- Versions
- Calculation 1.1.2 · CVP protocol 1.0.0-proposed · Evidence 2026-10-28.meta-metrics-v2
- Verification revision
- 2026-10-28.meta-metrics-v2 · 2/2 property · digest 7f68d65dd72b
- Legacy regression
- 13/13 tests · Production surface contract 5/5
- Trust layers
- Verification VERIFIED · Production CURRENT · Overall CVP state: VERIFIED under CVP 1.0.0-proposed
- 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
- 92/92 golden · 5/5 CVP boundary · 8/8 invalid · 2/2 property · 2/2 metamorphic · 4/4 cross-interface · 1/1 cross-calculator · 5/5 CVP contract · Manifest
- Sources
- ISO 80000-2:2019 Quantities and units — Mathematics (integer division / remainder)
- Knuth, The Art of Computer Programming, Euclidean division (remainder ≥ 0)
- MIT Mathematics for Computer Science — Chapter 8: Number Theory
- Evidence
- 3 legacy golden · 4 legacy boundary · legacy regression suite · 92/92 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.2 · Engine tested
- Engine tested 13/13 tests · Production surface contract 5/5
- Named expert review Not performed
- Calculation version 1.1.2
- 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: at most48 digits and512 token characters; safe JSON numbers or exact signed digit strings.
- 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 5/5 · View evidence
- a=17 modulus=5 → remainder=2
- a=-17 modulus=5 → remainder=3
- a=10 modulus=0 → error DIVISION_BY_ZERO
- Sources
- ISO 80000-2:2019 Quantities and units — Mathematics (integer division / remainder)Supports: Mathematical symbols and notation. This standard is not numerical verification or an endorsement of this implementation.
- Knuth, The Art of Computer Programming, Euclidean division (remainder ≥ 0)
- MIT Mathematics for Computer Science — Chapter 8: Number Theory — Chapter 8, including sections 8.2–8.9 and problem 8.24Supports: Divisibility, prime factorization, gcd and the Euclidean algorithm, lcm via prime exponents, division with remainder, modular congruence and multiplicative inverses. CalculatorX’s signed-remainder and zero-input policies are stated separately on the page. Mathematical reference only; not validation or endorsement of this implementation.
- ISO 80000-2:2019 Quantities and units — Mathematics (integer division / remainder)
- Calculation version
- 1.1.2
Background
Interpretation and common distinctions.
What does this modulo calculator compute?
Euclidean division writes a = q·m + r with remainder r satisfying 0 ≤ r < |m|. This is not JavaScript’s truncated remainder operator.
The published formula or method is a = q·m + r, 0 ≤ r < |m|. The following references support the stated mathematics or method:
- MIT Mathematics for Computer Science — Chapter 8: Number Theory: Divisibility, prime factorization, gcd and the Euclidean algorithm, lcm via prime exponents, division with remainder, modular congruence and multiplicative inverses. CalculatorX’s signed-remainder and zero-input policies are stated separately on the page. Mathematical reference only; not validation or endorsement of this implementation.
Which inputs and limits should you check?
Use signed integer digit strings, at most48 digits and512 token characters; JSON numbers must be safe integers. Scientific notation, decimal points, commas, null, booleans and nested values are rejected. Unknown fields and conflicting aliases are errors. A nonzero modulus is required; inverse additionally needs |m|≥2 and gcd(a,m)=1.
The worked example uses 17 divided by 5 with 17 = 3·5 + 2. Compare it with the Example calculations and the complete result for the same inputs.
How can you verify and cite this result?
CalculatorX is responsible for this page. The mathematical references above explain the model; implementation checks and their scope are documented separately in the math.modulo v1.1.2 Evidence and capability contract. Read the displayed verification and production state together with the specification's numerical limits.
Use the clean calculator URL to cite the tool. A shared input link identifies a particular calculation. Content updates, numerical verification, and domain reviews have separate dates and scopes.
Exact outputs and verification
All arithmetic uses BigInt, without floating rounding. Safe integer outputs are JSON numbers; larger exact outputs are signed decimal strings. The complete result includes the identity, algorithm, exactness model, work and calculation version. In inverse mode, the canonical Bézout coefficient x equals the returned inverse in [0,|m|), and y=(1−a·x)/m. These coefficients satisfy the original input identity a·x+m·y=1, including negative a and m.
For example, a=−3,m=11 gives inverse7, x=7,y=2: (−3)·7+11·2=1. Remainder/quotient obey a=q·m+r and0≤r<|m|. Integer changes can change these discrete outputs abruptly; floating conditioning and measurement uncertainty are not modeled. This implementation does not claim constant-time cryptographic behavior.
Inputs, sharing and remote calls
The main Modulo entry accepts remainder or inverse; the Modular Inverse discovery page and REST alias lock inverse, overriding a supplied mode. Share links use the current engine and do not preserve historical runtimes. Raw aliases are a/dividend and modulus/m/b; conflicting values reject rather than choosing one silently. Use digit strings for exact integers beyond the safe JSON numeric range. Errors include MISSING_REQUIRED_INPUT, INVALID_NUMBER, INVALID_MODE, UNKNOWN_INPUT, CONFLICTING_INPUT, VALUE_ABOVE_MAX, INPUT_TOO_LONG, DIVISION_BY_ZERO, INVALID_INPUT and NOT_INVERTIBLE.
Typing computes locally. Opening shared URLs and calling REST/MCP sends inputs to the server, where request URLs/metadata may enter logs. Recent calculations may remain in local browser history, which can be cleared. See the privacy policy; fixed retention, deletion guarantees and processing regions are not asserted here.
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.