HomeCalculatorsMathNumber Theory & Discrete MathModulo Calculator
Math calculator

Modulo Calculator

Integer remainder with a = q·m + r and 0 ≤ r < |m|. Euclidean convention, not JavaScript truncated %.

Instant result
Result
—

Enter values to calculate.

Inputs—
Mode—
Formula—
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 — ui-ssr is query-result HTML, not a live browser session. Error-path engine·REST·MCP 1/1 (status, code, calculation_version). SSR compared on URL-canonical requested calculations; empty query is idle (not an error) and JSON-typed object/array inputs are REST/MCP-only.
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)
Specification basis
Evidence
3 legacy golden · 4 legacy boundary · legacy regression suite · 8/8 oracle-backed golden · 8/8 invalid · Artifact integrity PASS
STALE · Build schema 1.1.1 matches page · production binding STALE · Semantic contract ✓ · Last attestation PASS · current evidence changed · re-attestation required · CVP STALE · attestation STALE — Production CURRENT withheld · Public/cache ✓ · Origin ✓
Semantic contract
PASS
Full verification

Manifest identity, reference classes, interfaces, suite, and production records.

Formulas

Core equations used by this calculator.

Identitya = q · m + r
Remainder range0 ≤ r < |m|
iShareable URLs use a and modulus. Do not use m in the query string — m is reserved on other calculators. REST still accepts m as an alias.

How to use

1

Enter dividend a

Any integer, including negative values.

2

Enter a non-zero modulus

The remainder is always in [0, |m|), even when m is negative.

3

Read remainder and quotient

Check a = q·m + r.

Example calculations

Common configurations with formula and result.

ϟ

Positive remainder

17 divided by 5

17 = 3·5 + 2
r=2
ϟ

Negative dividend

JavaScript (−17)%5 is −2; Euclidean remainder is 3

−17 = (−4)·5 + 3
r=3
ϟ

Negative modulus

Remainder still in [0, |m|)

17 = (−3)·(−5) + 2
r=2

Modulo calculator specification

Version 1.1.1 · Engine tested

Calculation status

Review policy · Evidence

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

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.