Skip to main content

Limited time: save up to 25% on spreadsheet models and templates.

Explore templates
10XSheets

Free calculator

Modulo calculator

Enter two integersdividend a and divisor n—and get the remainder of the division, written a mod n, computed the same way as MOD(a,n) in Google Sheets and Excel. You also see the integer quotient that pairs with that remainder and the decimal a÷n for context. This page is not modular exponentiation (a^b mod n) and not a multi-step expression engine—just transparent spreadsheet-style remainder math.

Educational illustration only. This is not exam policy, not curriculum software, and not a substitute for your course’s definition if your instructor uses a different remainder convention for negative inputs—this page follows Sheets/Excel MOD.

When to use this calculator

Quick remainder checks that line up with MOD in a workbook or lecture notes—without mixing in powmod tools.

  • Match =MOD(A1,B1) in Google Sheets or Excel when you are sanity-checking a cell that should repeat every n rows or wrap indices.
  • See a mod n on small negative examples where % in JavaScript would disagree with your spreadsheet.
  • Grab remainder, floor quotient, and decimal a÷n in one place when you are explaining division algorithm steps on a slide.
How do you calculate a modulo remainder?

The remainder (a mod n) here is the MOD function from Google Sheets and Microsoft Excel: MOD(a,n) = a − n × FLOOR(a/n), where FLOOR rounds toward negative infinity. That single rule fixes the sign of the remainder for negative a or n and matches what you get from =MOD(A1,B1) in a sheet.

Floor the ratio

Compute FLOOR(a/n) (toward −∞). That is the integer quotient shown on the results card and the one that pairs with MOD in the identity above—not necessarily QUOTIENT(a,n) when signs differ.

Subtract to get the remainder

The remainder is a − n × FLOOR(a/n). It is 0 when n divides a, otherwise it has magnitude less than |n|.

Worked example: a = −7, n = 3. FLOOR(−7/3) = −3. Remainder = −7 − 3×(−3) = 2. Check in a sheet: =MOD(-7,3) returns 2.

Inputs must be integers within JavaScript safe integer limits so every step is exact in the browser—no BigInt path in v1.

For percent change on the same workbook, open the percentage calculator.

To sort a pasted list of numbers, open the least to greatest calculator.

For means on a pasted list, open the average calculator.

FAQs cover zero divisors, JavaScript %, QUOTIENT vs FLOOR, and power modulo (not on this page).

Google Sheets & Excel

Both apps expose MOD(dividend, divisor) with the same floor-based remainder as this page. QUOTIENT uses truncation toward zero and can differ from the floor quotient shown here when signs disagree—use MOD + FLOOR patterns for consistency.

Remainder in a cell
=MOD(A1,B1)

Put dividend in A1 and non-zero divisor in B1. In Excel with a German locale, the function is often REST; in French Excel look for MOD / RESTE per your language pack.

Floor quotient (pairs with MOD)
=FLOOR(A1/B1)

FLOOR/FLOOR.MATH patterns match the integer quotient line on this page for typical numeric inputs—verify the exact function name in Insert function for your locale.

More tools in Spreadsheet math

Browse all tools

Frequently asked questions

What does “a mod n” mean?

It is the remainder after you divide a by n, with the convention used by Google Sheets and Excel MOD: a − n×FLOOR(a/n). The result has magnitude less than |n|, but its sign follows that MOD rule—not every programming language uses the same rule.

How is this the same as Excel MOD?

Microsoft documents MOD(n,d) as n − d×INT(n/d) where INT rounds down toward −∞ for real inputs—the same as FLOOR here. Google Sheets MOD matches that behavior for the integer values this page accepts.

Why not just use JavaScript percent?

The % operator in JavaScript uses a truncated-toward-zero quotient for a/n, so a % n can differ from Excel MOD(a,n) when a and n have opposite signs. This calculator always uses the MOD / FLOOR definition above.

What is the “integer quotient (floor)” line?

It is FLOOR(a/n), the unique integer q such that a = n×q + MOD(a,n) with this page’s MOD. Excel QUOTIENT(a,n) truncates toward zero instead, so it can disagree with q for some negative inputs.

What happens with negative numbers?

They are allowed when they are integers. The remainder follows MOD: for example MOD(−7, 3) = 2 and MOD(7, −3) = −2. Try the same pairings in a sheet to confirm.

What if the divisor is 0?

Division by zero is undefined. The tool blocks n = 0 and asks for a non-zero divisor.

Can I compute a^b mod n (power modulo)?

Not on this page—v1 is only the two-integer remainder that matches MOD. Tools that advertise modular exponentiation solve a different problem (often used in CS and crypto).

Which function names are localized?

MOD is widely consistent, but German Excel often shows REST for the same remainder; French packs may show RESTE. Use Insert function to match your language pack; the math on this page still follows the MOD identity above.