Math

Modulo Calculator

Calculate the remainder after division, including the quotient and a negative-number-correct result.

Last updated · View algorithm, constants and default inputs (JSON)

Enter your values

Remainder 2.0000
Results

About this calculator

Remainder depends on the division convention: this tool shows the truncating remainder and the non-negative Euclidean modulo. Division by zero is undefined and returns an input error.

Worked example

calculated with the default values below

Dividend 27 · Divisor 5 Remainder 2.0000 · Quotient 5.0000 · Euclidean modulo 2.0000 · Divisible exactly No

General background references

Disclaimer

These calculators give general mathematical results. They suit study, planning and estimation — verify anything that feeds a graded submission, a published figure or a financial commitment.

Maintained by: CalcDelta

Implementation source

This record describes the implementation used by this page. It is not independent validation. External references, when available, support only the stated formula or definition; estimates and custom rules retain their own assumptions.

View algorithm, constants and default inputs (JSON)

Formula and variables

q = trunc(a ÷ b); r = a − qb; r_E = ((a mod b) + |b|) mod |b|

q
truncated quotient
r
remainder (sign of a)
r_E
non-negative Euclidean remainder
a
dividend
b
divisor

Inputs must be integers and the divisor must be nonzero. The truncating remainder can be negative; Euclidean modulo is normalized to a non-negative result.

Embed this calculator

Copy the iframe snippet to place this calculator on your site. No account required. The snippet stays in sync with the inputs currently shown.

Frequently asked questions

Why is the Euclidean modulo positive when my remainder is negative?

The remainder uses Math.trunc of a over b, which rounds toward zero, so negative 27 modulo 5 gives negative 2 because the quotient is negative 5. The Euclidean modulo instead forces a non-negative result with parentheses a percent b plus absolute b close parentheses modulo absolute b, returning 3 for the same input. The Divisible exactly check keys off the trunc remainder being zero, so negative 25 shows Yes while negative 27 shows No even though both sit within 5 of a multiple.