Modulo Calculator

Division leaves two answers behind: how many whole times the divisor fits, and what is left over. The leftover is the remainder — the operation programmers type as %, and the arithmetic underneath clock faces, gear teeth, calendars and every pattern that repeats. This page returns both halves of the division and prints the equation that ties them together, so each result can be verified at a glance.

Enter values

The number being divided — decimals allowed

A positive whole number

Results update as you type.

Results

Remainder (a mod b)
1
Whole quotient
4
Division written out
25 = 4 × 6 + 1

How is the Modulo calculated?

Enter the dividend, the number being divided — decimals are fine — and a positive whole-number divisor. The remainder row shows the dividend mod divisor, keeping the sign of the dividend exactly as programming languages define it. The quotient row counts whole fits and truncates any fraction. Beneath them the page writes the division out in full: dividend equals quotient times divisor plus remainder, using a minus sign when the remainder is negative.

Formula

a = q × b + r, where r is a mod b, the remainder, and q = trunc(a ÷ b), the whole quotient. For a = 25 and b = 6 that reads 25 = 4 × 6 + 1. The % operator in JavaScript and most languages returns the same remainder, decimals included: 7.5 mod 2 is 1.5 with quotient 3. The divisor must stay positive, and the remainder never reaches the divisor.

Example

Twenty-five objects into boxes of six make four full boxes with 25 − 24 = 1 left over, displayed as remainder 1, quotient 4 and the line 25 = 4 × 6 + 1. Flip the dividend negative and −25 mod 6 keeps the sign, returning −1 with quotient −4, written out as −25 = −4 × 6 − 1. Clocks run on the same operation: 10 hours after 23:00 is 33 mod 24, which lands on 9:00 the next morning.

Things to remember

Remainders are the slice of division most often dropped, yet schedules, hashes and calendars are built on them. A negative remainder takes the sign of its dividend — read the minus in the written equation as part of the identity, not a fault. Which number divides another evenly is a job for the HCF calculator.

Frequently Asked Questions

What is the modulo operation in maths?

It is the remainder after division: a mod b is what remains once whole copies of b are removed from a. So 25 mod 6 equals 1, because four sixes take 24 and one object is left over. Programmers write the same operation with the percent sign.

Why is my remainder showing as negative?

Because the remainder takes the sign of the dividend, matching JavaScript, Python and most languages. −25 mod 6 returns −1 rather than 5, and the written-out row keeps the identity honest: −25 = −4 × 6 − 1. Add the divisor once yourself if a positive remainder is what you need.

What is the difference between remainder and modulo?

In everyday arithmetic they name the same number, but modulo is the operation itself and languages differ in how they treat negative dividends. For positive dividends and divisors — the common case — every definition agrees, and this calculator follows the programming convention throughout.

Can the divisor itself be a decimal?

Not here: the divisor must be a positive whole number, while the dividend may be fractional — 7.5 mod 2 gives 1.5 with quotient 3. Fractional divisors are meaningful in specialised mathematics but rare in practice, so the page keeps the rule simple.