CalcaTools

Modulo Calculator

A Modulo Calculator is a free online tool that solves modulo operation using modulo operation, modulus math, mod arithmetic. Students, teachers, and engineers use it to check homework, prep for exams, and verify hand calculations against published guidance from NIST Mathematics Encyclopedia.

Last updated: June 2026 · Free · No sign-up required

Results

Enter values above and click Calculate to see your result instantly.

Quick reference

ExpressionResult
17 mod 52
20 mod 40 (divisible)
7 mod 107
-7 mod 32 (floored) or -1 (truncated)

functions Shows the working, not just the answer

For students and teachers, the final number is only half the value. Every math tool here exposes the formula it applied, the intermediate steps, and the rounding rule, so you can follow along, check your homework, or use the answer in a proof or report with confidence.

calculate Accurate to the spec

Calculations use 64-bit floating point with sensible rounding for the domain (currency to 2 decimals, percentages to 4 decimals, algebra to 6 significant figures). Where exact rational arithmetic matters — fractions, factorials, simplification — we use a dedicated BigNumber path so 1/3 + 1/6 returns ½, not 0.49999.

school Free for classroom use

Educators are welcome to link to any math calculator on CalcaTools from a class site, Google Classroom, or worksheet. The pages are mobile-friendly, free, ad-supported (so we can keep them free) and have no sign-up wall — students just click and use them in class or at home.

tips_and_updates Pair with the spoke articles

Below the calculator we link a small set of plain-English explainer pages — "What is a percentage?", "Why does PEMDAS matter?", and so on. They cover the underlying concept in 4–6 short paragraphs. Read those before the calculator if the topic is new, or after if you want the extra context.

Interpretation guide

Use modulo to…Example
Test divisibilityn mod d = 0
Find even/oddn mod 2
Wrap around a cycleclock: (h + k) mod 12
Hashing / cryptographyx mod p

Formula & methodology

Formula: a mod n = a - n x floor(a / n) (the remainder of a divided by n)

How the modulo operation works

The modulo (mod) gives the remainder left over after dividing one number by another.

Example: 17 mod 5

17 / 5 = 3 with 2 left over, because 5 x 3 = 15 and 17 - 15 = 2. So 17 mod 5 = 2.

Modulo is the backbone of clock arithmetic, divisibility tests (n mod 2 tells you even or odd), hashing, and cryptography. Note that languages differ on the sign of the result for negative inputs — some "floor" toward negative infinity, others "truncate" toward zero.

Authoritative source: NIST Mathematics Encyclopedia

Frequently asked questions

What is the modulo operation?
Modulo (often written a mod n or a % n) returns the remainder after dividing a by n. For 17 mod 5, since 5 goes into 17 three times with 2 left over, the result is 2. It answers 'what is left after taking out as many whole groups of n as possible?'
How do you calculate a mod n by hand?
Divide a by n, take the whole-number part of the quotient, multiply it back by n, and subtract from a. For 23 mod 7: 23 / 7 = 3 (whole part), 3 x 7 = 21, and 23 - 21 = 2, so 23 mod 7 = 2. The remainder is always between 0 and n - 1 for positive inputs.
What is modulo with negative numbers?
It depends on the convention. With floored division (used in Python and math), -7 mod 3 = 2 because the result takes the sign of the divisor. With truncated division (used in C and Java), -7 % 3 = -1 because it takes the sign of the dividend. Always check which convention your tool or language uses.
What is modulo used for?
Modulo is used to test divisibility (n mod d = 0 means d divides n), to tell even from odd (n mod 2), to wrap values around a cycle like hours on a clock or days of the week, and extensively in computing for hashing, random number generation, and cryptographic algorithms.
What is the difference between mod and division?
Division tells you how many times one number fits into another (the quotient); modulo tells you what is left over (the remainder). For 17 and 5, division gives 3 and modulo gives 2. Together, a = n x quotient + remainder, so they are two parts of the same operation.