Code tool

Remainder Calculator

Enter two integers to see the quotient, JavaScript % result, and Euclidean remainder side by side.

In-browser processingNo account requiredPrivacy details ↗

Integers up to 1,000 digits; divisor cannot be zero.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter a dividend and a non-zero divisor.
  2. Choose Calculate.
  3. Compare the signed JavaScript remainder with the Euclidean remainder.

Two remainder conventions

JavaScript % follows truncation toward zero, so its remainder has the dividend's sign. The Euclidean remainder is always non-negative and uses the positive divisor magnitude: ((a % |b|) + |b|) % |b|.

Finite, bounded integers

Inputs must be decimal integers with at most 1,000 digits. The divisor cannot be zero. BigInt keeps the calculation exact and local to this browser.

GOOD TO KNOW

Common questions

Why do the two remainders differ?

They use different conventions for negative dividends or divisors. They are equal whenever the JavaScript remainder is already non-negative.

Can the divisor be negative?

Yes. The quotient follows BigInt division and the Euclidean remainder uses the divisor magnitude.

What happens with zero?

A zero dividend is valid; a zero divisor is rejected because division by zero is undefined.