Skip to content

Modulo Calculator

Enter a dividend and a divisor to get the remainder, the truncated and floored quotients, and the version of the remainder that is never negative. An optional exponent also returns dividend raised to that power, modulo the divisor. With 17 and 5 the remainder is 2, and the always-positive version is 2.

Updated 2026-11-18 Editorial estimate Calccc Editorial Team Free · No sign-up

The number you divide by. The remainder is always smaller than this.

Advanced options

Also returns dividend^exponent mod divisor, which is how modular exponentiation is used in computing.

Scenarios A/BSave two input sets and compare the results. Stored only in this browser.
AEmpty
BEmpty

Your inputs stay in this browser. No account, no uploads.

Professional worksheet

Detailed schedule & assumptions

Inputs used, method, sensitivity, and any year-by-year table. The summary above stays compact; the audit lives here.

Professional worksheet

Inputs, scope, and sensitivity

Inputs used

Advanced inputs used

Method and scope

Result audit

MetricValue

What this calculator does

Modulo is the remainder after division, and it appears in more places than it first seems: working out which day of the week a date falls on, cycling through a list, checking whether a number is even, and the modular arithmetic behind encryption. The operation is simple, but programming languages do not all agree on how to handle negative numbers. JavaScript and many other languages give a remainder with the sign of the dividend, so -17 mod 5 is -2. In mathematics, the modulo result is usually taken to be in the range zero to one less than the divisor, so -17 mod 5 is 3. Both answers are useful, and this calculator shows both so you can match the convention your code or textbook expects. The optional modular power is the other workhorse: computing a large power and then taking the remainder is how modular exponentiation stays manageable.

How to use it

  1. Enter the dividend, the number being divided.
  2. Enter the divisor, the modulus, which must be greater than zero.
  3. Read the remainder and the quotient that matches your convention.
  4. Check the divide identity to confirm the arithmetic.
  5. Optionally add an exponent to compute a modular power.

How it works

Dividend = divisor × quotient + remainder. The truncated remainder keeps the sign of the dividend; the floored remainder is ((remainder mod divisor) + divisor) mod divisor. In the default case: 17 = 5 × 3 + 2, so the remainder is 2 and 17^3 mod 5 = 3.

Example calculations

Example 1: A simple positive division

17 divided by 5 is 3 remainder 2. The decimal quotient is 3.4000, and the always-positive remainder is also 2. Power mod with exponent 3 gives 3.

Example 2: A negative dividend

For -17 mod 5, the truncated quotient is -3 and the remainder is -2. The mathematical version is 3, and the floored quotient is -4. Both satisfy the divide identity, which is why language choice matters.

Example 3: Modular exponentiation

Computing 7^128 mod 13 by brute force would need a number with more than a hundred digits. Repeated squaring gives 3 directly, because the result is reduced modulo 13 at every step.

What the result means

The remainder tells you how far a number is past the last multiple of the divisor, and the quotient tells you how many multiples fit. For positive numbers the two conventions agree, and the quotient is just the integer part of the division. For negative numbers they diverge: the truncated version answers how many whole divisors fit while staying above the dividend, and the floored version answers how many multiples fit below zero. Use the sign convention your language or library documents. Modular powers behave in surprising but useful ways: the sequence of powers modulo a number eventually repeats, and that cycle is the basis of many hashing and encryption schemes.

Common mistakes

  • Assuming every programming language returns a non-negative remainder.
  • Using a divisor of zero, which makes the operation undefined.
  • Confusing the remainder with the decimal part of the quotient.
  • Taking the remainder of a rounded or truncated value instead of the original number.
  • Forgetting that the modulo result always has the same sign as the divisor in the floored convention.
  • Computing a huge power before taking the modulus instead of reducing at each step.

Assumptions and limits

  • The dividend and divisor are integers.
  • The divisor is not zero.
  • The truncated convention matches JavaScript and many C-family languages.
  • The floored convention matches the mathematical definition of congruence.
  • Modular exponentiation uses repeated squaring with a non-negative exponent.

Frequently asked questions

What is modulo in simple terms?

It is the remainder after dividing one whole number by another. 17 mod 5 is 2 because 5 goes into 17 three times with 2 left over.

Why is -17 mod 5 different in different tools?

Some languages keep the sign of the dividend, giving -2, while mathematics uses the non-negative representative, giving 3. Both are valid conventions; the calculator shows both.

Can the divisor be negative?

Mathematically yes, but the result convention changes again. This tool uses the absolute value of the divisor and shows the standard non-negative remainder, which covers most practical uses.

What is modular exponentiation used for?

It computes a large power modulo a number without ever forming the huge number itself. It is used in cryptography, hashing, checksums, and competitive programming.

How do I check whether a number is even?

Take the number modulo 2. A remainder of 0 means Even; a remainder of 1 means odd. The same trick works for divisibility by any small number.

What happens if the divisor is zero?

Division by zero is undefined, so the modulo operation has no result. The calculator returns an error in that case.

Sources

This is an educational arithmetic tool. Results assume integer inputs and a non-zero divisor. Programming languages differ in how they handle negative dividends, so confirm the convention used by your language or library.

2026 update

How to use the professional output

This page is not just a formula box. The result is designed to be checked, compared, and taken away.

  • Professional worksheet. The result includes the inputs used, the method and scope, and a one-variable sensitivity check for finance calculators.
  • A/B scenarios. Save two input sets in the browser and compare the primary, secondary, and breakdown figures side by side.
  • Print / PDF and CSV. Print a branded worksheet, or export the year-by-year table when the calculator produces one.

The formulas and assumptions above still govern the number. The worksheet makes the estimate auditable; it does not make it a lender quote, tax return, or personalized advice.

Calccc Editorial Team · Updated 2026-11-18

Prepared by Calccc Editorial Team as an educational estimate. This page is not a licensed professional review and is not financial, medical, legal, or tax advice.

Editorial estimate prepared by the Calccc Editorial Team; not a licensed professional review.