Skip to content
Omnikalc

Remainder calculator: quotient, remainder and modulo

Divide two whole numbers to get the quotient and remainder, the decimal result, the mixed number and the modulo used in programming.

Updated on
Your inputs

Value out of range

Value out of range

Results

Quotient

9

Remainder

2

Decimal result
9.400000
Remainder with truncation (% in C, Java, JavaScript)
2
Modulo with floor division (Python a % b)
2
Check: divisor × quotient + remainder
47

Other dividends

QuotientRemainderDecimal result
-7 current-23-1.400000
0 current000.000000
7 current121.400000
47 current929.400000
100 current20020.000000
365 current73073.000000

Division with a remainder

When a whole number does not divide another exactly, the division leaves a remainder. Euclidean division writes any dividend a and non-zero divisor b as a = b × q + r, where q is the quotient and r the remainder, with 0 ≤ r < |b|. This is the long division taught in school, and it is also the “mod” operation used in programming, calendars and clocks.

Worked example: 47 ÷ 5

  1. 5 goes into 47 nine times: 5 × 9 = 45.
  2. Remainder: 47 − 45 = 2.
  3. So 47 = 5 × 9 + 2: quotient 9, remainder 2.
  4. As a decimal: 47 ÷ 5 = 9.4; as a mixed number: 9 2/5.

Negative numbers and programming languages

With negative numbers, conventions differ:

  • Euclidean division keeps the remainder positive: −7 = 5 × (−2) + 3, so the remainder is 3.
  • Truncated division, used by the % operator in C, C++, Java and JavaScript, rounds the quotient toward zero: −7 % 5 = −2.
  • Floored division, used by % in Python and by MOD in spreadsheets, gives a remainder with the sign of the divisor: −7 % 5 = 3, and 7 % −5 = −3.

The calculator shows all three, so you can check what your code will return.

Results for other dividends (divisor 5)

Dividend Quotient Remainder Decimal
−7 −2 3 −1.4
0 0 0 0
7 1 2 1.4
47 9 2 9.4
100 20 0 20
365 73 0 73

Everyday uses of the remainder

  • Packing: 47 eggs in boxes of 6 fill 7 boxes with 5 eggs left over.
  • Calendars: 100 days from a Monday is a Wednesday, because 100 mod 7 = 2.
  • Clocks: 30 hours after 9:00 is 15:00 the next day, since (9 + 30) mod 24 = 15.
  • Even and odd: a number is even when its remainder by 2 is 0.
  • Divisibility tests: a number is divisible by 3 or 9 when the sum of its digits is.
  • Check digits: ISBNs, credit card numbers (Luhn algorithm) and IBANs use remainders to catch typing errors.

Remainder and fractions

The remainder over the divisor is the fractional part: 2 ÷ 5 = 0.4. If you only need to know whether b divides a, check that the remainder is 0. Dividing by 0 is undefined, so the calculator refuses a divisor of 0.

Frequently asked questions

How do you find the remainder of a division?

Subtract the divisor times the whole-number quotient from the dividend. For 47 ÷ 5, the quotient is 9 and the remainder is 47 − 45 = 2.

What is 47 mod 5?

2, because 47 = 5 × 9 + 2.

Why does −7 % 5 give different results in different languages?

C, Java and JavaScript truncate the quotient toward zero and return −2. Python and spreadsheets floor the quotient and return 3, which is also the Euclidean remainder.

How do I write a remainder as a fraction or decimal?

Put the remainder over the divisor: 47 ÷ 5 = 9 2/5, which is 9.4 as a decimal.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.