CalcWorldHub
Free online calculator · no signup

Remainder calculator

Find the Euclidean remainder of one integer divided by another, including for negative dividends.

4,000 tools
Remainder calculator — Dividend, Divisor and calculation method
Remainder calculator: inputs and calculation method.

How to use this calculator

Find the Euclidean remainder of one integer divided by another, including for negative dividends.

  1. Enter Dividend, Divisor. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Math guide

How this calculation works

Euclidean division returns a nonnegative remainder even when the dividend is negative. The quotient is chosen so that dividend = divisor × quotient + remainder and the remainder is smaller than the absolute divisor.

Inputs and meanings

dividend — Dividend
Enter the integer to divide.
divisor — Divisor
Enter a nonzero integer divisor.

Formula and method

a = bq + r, where q = floor(a / |b|) adjusted for the sign of b, and 0 ≤ r < |b|.

The nonnegative Euclidean remainder differs from some programming-language remainder operators for negative inputs. The displayed quotient and remainder satisfy the division identity.

Worked example

Find the Euclidean remainder of one integer divided by another, including for negative dividends.

For −17 ÷ 5, the Euclidean quotient is −4 and the remainder is 3: 5 × (−4) + 3 = −17, with 0 ≤ 3 < 5.

Assumptions and limits

Both inputs must be safe integers and the divisor cannot be zero. The result is defined for negative values using the stated Euclidean convention.

Frequently asked questions

Why is the remainder positive for a negative dividend?

This calculator uses Euclidean division, which defines the remainder in the range zero to one less than the absolute divisor.

Is this the same as JavaScript’s % operator?

Not for every negative input. Some languages use a signed remainder; this page uses a nonnegative Euclidean remainder.

What happens if the divisor is zero?

Division by zero is undefined, so the calculator asks for a nonzero divisor.

How do I use the Remainder calculator?

Enter Dividend, Divisor. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Remainder?

Find the Euclidean remainder of one integer divided by another, including for negative dividends. For −17 ÷ 5, the Euclidean quotient is −4 and the remainder is 3: 5 × (−4) + 3 = −17, with 0 ≤ 3 < 5.