All tools · Utilities

Modulo Calculator

Remainder and integer quotient of a ÷ b.

Free to use, no sign-up required. Modulo Calculator is one of 198 tools built into Xenition, alongside a chat that can use them for you.

Finds the remainder (a mod b) and the whole-number quotient when a is divided by b. Programmers use it for wrap-around counters and even/odd checks, and students use it for remainder problems.

How to use Modulo Calculator

  1. Enter a (dividend), the number being divided.
  2. Enter b (divisor), which cannot be 0.
  3. Read a mod b (the remainder) and a ÷ b (quotient), plus the line explaining how they fit together.

How it works

The quotient is a ÷ b with the decimal part cut off (truncated toward zero), and the remainder is JavaScript’s % operator. The two always satisfy a = b × quotient + remainder. Decimals work too, and the remainder takes the sign of a.

Example

17 mod 5 = 2 with quotient 3, because 5 × 3 = 15 and 17 − 15 = 2. For −17 and 5 the tool gives remainder −2 and quotient −3. With decimals, 7.5 mod 2 = 1.5.

Questions about Modulo Calculator

Why is −17 mod 5 shown as −2 and not 3?

There are two common conventions. This tool truncates, as JavaScript, C and Java do, so the remainder keeps the sign of a. Python and most maths texts floor instead and would give 3. Add b to a negative result to convert: −2 + 5 = 3.

How do I tell if a number is even with modulo?

A whole number is even when n mod 2 is 0. Any other result means it is odd.

Use it from chat

You do not have to open Modulo Calculator to use it. Ask Xenition in plain language and it runs the right tool, then carries the answer into whatever you are working on — a document, a spreadsheet, a deck.

Related tools