Mathematics calculator

Modulo Calculator

Find the modulo defined by floor division, including the convention used for negative and decimal values.

Calculator inputs

Enter your values

a mod b
Calculated output

Result summary

Your result will appear here

Complete the required fields and select the calculate button.

A division identity linking dividend, divisor, quotient, and remainder
Modulo uses the floor of the quotient, which matters when either input is negative.

What Is Modulo?

Modulo gives the remainder associated with a specified division convention. This calculator uses floor division: it rounds the quotient downward, multiplies that integer by the divisor, and subtracts the product from the dividend.

For positive inputs, the result resembles the familiar remainder from grouping objects. Negative values make the convention important: floor-defined modulo and a quotient truncated toward zero can give different answers while both satisfy their respective division identities.

The preserved route spelling is modulor, but the operation is modulo. This is not Le Corbusier’s architectural Modulor proportion system and does not calculate modular inverses.

How to Calculate Modulo

  1. Enter the dividend in a. This is the number being divided.
  2. Enter a nonzero divisor in b. Positive, negative and decimal values are accepted.
  3. Calculate. The tool divides a by b and takes the floor of that quotient.
  4. Read the modulo and the separate floor quotient. Check the identity a = b × q + modulo.
  5. For negative values, compare the floor convention with the rule required by your problem or programming language.

Zero is allowed as a dividend, but never as a divisor. Do not round a decimal quotient before taking its floor: doing so can move it across an integer boundary and change the result.

Modulo Formula Using Floor Division

q = floor(a ÷ b)

a mod b = a − b × q

a mod b = a − b × floor(a ÷ b)

Floor means the greatest integer no greater than the quotient. For example, floor(−3.8) is −4, not −3. This distinction determines the sign behavior. Decimal calculations use floating-point arithmetic, so tiny rounding residues can occur.

Dividend, Divisor and Floor Quotient

a
dividend
b
nonzero divisor
floor
greatest integer no larger than a ÷ b
modulo
remainder returned by the formula

Modulo Calculation Example

Illustrative example. Calculate −23 modulo 6 using floor division.

Floor(−23 ÷ 6) is −4. Therefore −23 − 6 × (−4) = 1. By comparison, truncating toward zero would give a signed remainder of −5. The answers differ because the quotient conventions differ.

Calculation check. The displayed results were checked independently against the stated formula and calculator response. Keep intermediate precision until the final step.

Illustrative modulo calculation example
QuantityResult
Dividend−23
Divisor6
Floor quotient−4
Modulo1

Modulo Sign Conventions

For a positive divisor, the floor-defined result lies from zero up to, but not including, the divisor. For a negative divisor, a nonzero result has the divisor’s sign. Programming languages do not all use this convention.

Modulo Sign Conventions
InputsFloor quotientModulo
23 mod 635
−23 mod 6−41
23 mod −6−4−1
−23 mod −63−5

How to Interpret Modulo with Negative Numbers

For a positive divisor b, the result is at least zero and less than b. This makes modulo useful for repeated cycles, wrapped positions and testing whether numbers belong to the same residue class.

For example, a cycle of six positions maps −23 to position 1 under floor modulo. That does not mean the original number became positive; it identifies an equivalent position after complete cycles are removed.

With a negative divisor, a nonzero result has the divisor’s sign. Thus 23 mod −6 is −1, not 5. If your task requires indices from zero upward, use the positive cycle size rather than assuming every negative-divisor result is a nonnegative index.

A zero result means the dividend is an exact multiple under the calculation. For decimal inputs, binary floating-point representation can leave a small numerical residue. For very large integers or exact decimal requirements, use suitable exact-arithmetic software and verify precision limits.

A modular inverse is a different question: it asks which multiplier produces a residue of one. This calculator does not test inverse existence or solve that equation.

Common Modulo Mistakes

  • Dividing by zero.
  • Assuming every system treats negative remainders alike.
  • Confusing modulo with the quotient.
  • Copying the result without its units or the inputs that produced it.
  • Assuming the modulo calculator covers factors that are not present on its form.

Frequently Asked Questions

What does the Modulo calculator do?

It is used to find the remainder defined with a floor-division rule. The formula and example on this page show exactly how the result is formed.

What example can I use to check the Modulo calculator?

Use the values in the worked example. They should produce 2, subject to the displayed rounding.

Why might my modulo calculator result differ from another source?

For the modulo calculator, another source may use a different unit, convention, rounding point or assumption. Compare its formula and inputs before comparing answers.

How many decimal places should I keep for modulo calculator?

Keep enough digits to avoid changing the calculation, then round the final modulo calculator result to match the precision of the original values.

Can I enter zero in the modulo calculator?

In the modulo calculator, zero is accepted only where it has a defined meaning. A denominator, term or other required positive quantity cannot be zero.

Is 2 always the right interpretation?

It is the result for the worked example only. Your answer depends on your own entries and on these limits: The divisor cannot be zero. Decimal inputs are accepted, but floating-point arithmetic can produce tiny representation differences for some values.

Should I rely on the modulo calculator alone?

Use the modulo calculator to check arithmetic. Review original records and seek suitable professional advice when the result affects a financial, medical, safety or contractual decision.

Can a decimal modulo have a tiny rounding residue?

Yes. Decimal values use floating-point arithmetic. When exact decimal or very large integer behavior matters, verify with an appropriate exact-arithmetic method rather than relying on a displayed approximation.

Sources and References