Remainder Calculator

Calculate the remainder of two numbers (a divided by b) — the result always takes the sign of the dividend, matching the convention used by most calculators and programming languages like JavaScript and C.

  • Free to use
  • Accurate results
  • No registration required
  • Works on all devices
Enter a dividend and divisor to calculate the remainder, where the result takes the sign of the dividend.
The number being divided.
The number you're dividing by.

Your result

-1

Remainder (a % b)

Modulo (a mod b, sign follows divisor)2

AI explanation

Formula

remainder = a − b × trunc(a / b) — the result takes the sign of the dividend a

Worked example

-7 divided by 3, remainder

Worked example: -7 divided by 3, remainder
FieldValue
Dividend (a)-7
Divisor (b)3
Remainder (a % b)-1
Modulo (a mod b, sign follows divisor)2

Assumptions

  • The divisor cannot be zero.
  • When the dividend and divisor have the same sign, remainder and modulo give the same result — they only differ when the signs differ. See the Modulo Calculator for the other convention.

Frequently asked questions

What is the difference between remainder and modulo?

They agree when the dividend and divisor have the same sign. When the signs differ, remainder (this calculator's primary result) always takes the sign of the dividend, while modulo (see the Modulo Calculator) always takes the sign of the divisor.

Why does -7 divided by 3 leave a remainder of -1, not 2?

Remainder uses truncated division (rounding toward zero): -7 ÷ 3 truncates to -2, and -7 − (3 × -2) = -7 + 6 = -1. This convention (used by JavaScript's % and most calculators) always returns a result with the same sign as the dividend.

Is this the same as long-division remainder from school?

For positive numbers, yes — long division and this calculator agree. The difference only shows up with negative numbers, where this convention (truncating toward zero) matches how most calculators and programming languages compute it.

Related calculators

Report a calculation issue