Modulo Calculator (a mod n)

Modulo calculator: a mod n with the mathematical (always non-negative) result and the truncated remainder used by most programming languages.

a mod n = a − n · ⌊a / n⌋

How to use this calculator

  1. Type your input in the box.
  2. The result updates as you type.
  3. Use “Copy result” or “Copy link” to share it.

a mod n = a − n × floor(a / n). For negative numbers the two conventions differ: −17 mod 5 = 3, but −17 % 5 = −2 in C or JavaScript.

Frequently asked questions

What is 17 mod 5?

2.

Related calculators

Last updated: · Report an error