🔧Toolify

Modulo Calculator - Remainder of a mod b

A free online modulo calculator that computes a mod b, the remainder left after dividing a by b. Enter a dividend and a non-zero divisor to get the result instantly.

Enter a value for a and a non-zero value for b.

Related tools

How it works

What is the modulo operation?

The modulo operation, written a mod b, returns the remainder after dividing a by b. For example, 17 mod 5 equals 2, because 17 divided by 5 is 3 with 2 left over.

The divisor b must not be zero, since division by zero is undefined.

Where modulo is used

Modulo is everywhere in math and programming: checking even or odd numbers, wrapping array indices, building hash tables, and clock arithmetic.

It is also the foundation of modular arithmetic used in cryptography and number theory.

Frequently asked questions

What does a mod b mean?

It is the remainder left after dividing a by b. For example, 17 mod 5 equals 2.

Why can't b be zero?

Division by zero is undefined in mathematics, so the divisor b must be a non-zero number.

How is modulo of negative numbers handled?

Results follow standard math conventions; the sign of the remainder may differ from some programming languages.

Is the result always smaller than b?

For positive operands, the remainder is always between 0 and b minus 1.

What is modulo used for in programming?

Common uses include checking even or odd numbers, cycling through indices, and hashing.

Disclosure
  • NordVPN

    Sponsored

    Strict no-logs VPN with 6,400+ servers in 111 countries. Threat Protection blocks ads, trackers, and malware while you work online.

    Get NordVPN
  • Cloudways

    Sponsored

    Managed cloud hosting for WordPress and web apps on DigitalOcean, Vultr, and AWS. Fast setup, no server headaches.

    Try Cloudways

Comments & questions