All math Calculators
Online Modulo Calculator

Online Modulo Calculator

Find a mod b — the remainder after division — for any two numbers, with an always-non-negative result you can copy in one click.

Modulo

1

Oops! Something went wrong. Please try again.

What Is This Tool?

The Modulo Calculator finds a mod b, the remainder left after dividing the first number by the second. You enter a value for a and a value for b, click Calculate, and see the result — for example, 5 mod 2 is 1. It always returns a non-negative remainder, so even a negative input like -5 mod 2 gives 1, and it lets you copy the answer to your clipboard with one click.

How to Use This Tool?

  • Enter the dividend in the field marked a.
  • Enter the divisor in the field marked b.
  • Click the Calculate button to see a mod b.
  • Click the copy icon to copy the result to your clipboard.

Key Features

  • Calculates a mod b, the remainder after dividing a by b.
  • Always returns a non-negative result, even when a is negative.
  • Accepts whole numbers as well as decimal values for both inputs.
  • Flags a zero divisor, since modulo by zero is undefined.
  • Includes a one-click copy button to place the result on your clipboard.

Examples

  • 5 mod 2 equals 1.
  • 10 mod 3 equals 1.
  • -5 mod 2 equals 1, because the result is kept non-negative.
  • 7 mod 7 equals 0.

Common Use Cases

  • Checking whether a number is even, odd, or divisible by another.
  • Wrapping values around a range, such as hours on a 12-hour clock.
  • Distributing items evenly and finding the leftover amount.
  • Verifying remainder results from programming or spreadsheet formulas.
  • Teaching or practicing remainder and modular arithmetic concepts.

Tips & Best Practices

  • Enter the number being divided as a and the number you divide by as b.
  • Use a non-zero value for b, since dividing by zero is undefined.
  • Expect a non-negative result, which may differ from a programming language's sign rules.
  • Use whole numbers for standard modular arithmetic; decimals are also supported.
  • Copy the result directly from the tool to avoid transcription mistakes.

Limitations

  • Calculates one a mod b operation at a time, not a list or batch.
  • The divisor b cannot be zero, which triggers an error.
  • Always returns a non-negative remainder, which differs from some languages' sign conventions.
  • Very large or highly precise numbers are subject to digital precision limits.

Frequently Asked Questions

What does the modulo operation do?
It returns the remainder left after dividing a by b; for example, 5 mod 2 is 1.

Why is -5 mod 2 equal to 1 here?
The tool always returns a non-negative remainder, so the result lands between 0 and b.

Can b be zero?
No. Modulo by zero is undefined, so a zero divisor shows an error message.

Does it work with decimals?
Yes. Both inputs accept decimal values, not just whole numbers.

Key Terminology

Modulo
An operation that returns the remainder after one number is divided by another.
Dividend
The number being divided, entered as a in this tool.
Divisor
The number you divide by, entered as b, which must not be zero.
Remainder
The amount left over after dividing one number by another.
Non-negative result
A remainder kept at zero or above, so it falls between 0 and b.

Quick Knowledge Check

What is 5 mod 2?
What does the modulo operation return?
Which value of b is not allowed?