Maths & numbers

Integer quotient and remainder calculator

Find the Euclidean quotient and nonnegative remainder, including for a negative dividend.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

A calendar or repeating cycle often needs a nonnegative remainder. Truncating −17/5 toward zero instead gives −3 and a negative remainder.

THE FORMULAa = bq + r, where q = floor(a/b) and 0 ≤ r < b

A worked example

−17 = 5 × (−4) + 3, so the quotient is −4 and the remainder is 3.

Good to know

The divisor is positive. Some languages use a quotient truncated toward zero.

Read the result

Find the Euclidean quotient and nonnegative remainder, including for a negative dividend.

The primary result is labeled “Floor quotient”. Keep the input definitions in view when comparing this result with another method.

Try a related calculation

The divisor is positive. Some languages use a quotient truncated toward zero.

For a related exercise, try the fraction calculator.

A few questions, answered

How can I check the default inputs by hand?

−17 = 5 × (−4) + 3, so the quotient is −4 and the remainder is 3.

Which rule does this calculator apply?

a = bq + r, where q = floor(a/b) and 0 ≤ r < b

Find your calculator

Start typing to explore the library.